Am I using this "string?" in regex ^\/(.*)\w+$
it detects values that start like this: /STRINGQUALQUER
would like to get STRINGQUALQUER
, what code do I use? I use jQuery.
Am I using this "string?" in regex ^\/(.*)\w+$
it detects values that start like this: /STRINGQUALQUER
would like to get STRINGQUALQUER
, what code do I use? I use jQuery.
The regex you have now can be broken down into 5 parts to see what it has and how it works:
^
marks the beginning of the string. \/
means /
(.*)
word characters (letters, numbers and \w+
) _
end of string If you want to catch the content after $
just use /
. It omits that the slash has to be at the beginning of the string but tells the regex that there must be a slash before the other characters of the string, using \/(.*)
.
Well I understand you have a string /stringqualquer
and would like to get the value of stringqualquer
without the /
up front. Correct?
If this is your problem this should resolve:
[?<=\/](\w*)
or so:
\/?(\w*)
You can test online here .
My response was based on the response from @Renato Dinhani Conceição, which is here at SO PT .
I just switched ,
to \/?
and ([0-9]+)
to (\w*)
to meet your need.