I have small requirement.I want to search a string with exact match. Suppose i want to search for None_1, i am searching for 'None_1' using /None_1/, but it is matching even "xxxNone" but my requirement is it should match only None_[any digit]. Here is my code
/^None_+[0-9]{?}/
So it should match only None_1 , None_2
You should also anchor the expression at the end of the line. But that alone will not make it work. Your expression is wrong. I think it should be:
/^None_[0-9]+$/
^ matches the beginning of a line[0-9]+ matches one or more digitsNone_ matches None_$ matches the end of a lineIf you only want to match one digit, remove the +.
Your original expression /^None_+[0-9]{?}/ worked like this:
^ matches the beginning of a lineNone matches None_+ matches one or more underscores[0-9] matches one digit{? matches an optional opening bracket {} matches }If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With