This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I am absolutely terrible at regex and need to know how to determine if a value in a select is either 1 or 2, and not 0.
There are three options and only 2 are valid.
This is to be used as the validation regex for the jQuery validationEngine plugin.
Thanks in advance.
If you mean to match the literal strings "1" and "2",
/^[12]$/
will suffice.
The easiest way is to probably just check with ==, but if you really want to use regex:
var regex = /^[12]$/;
Related
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
Can someone help me out here? I need a regex that will match the following pattern:
10-(any 5 digits except 73480)-(any 4 digits)
Examples
valid: 10-12345-1234
invalid: 10-73480-1234
Thanks
You should use negative lookahead to check for any occurance of 10-73480 before matching..
^(?!10-73480)10-\d{5}-\d{4}$
Try it here
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
Can anyone tell me meaning or possible values of below regular expression?
/(\+\d{2})/
Plus followed by a number on 2 digits.
This matches for instance: +23
A + followed by 2 digits: +23 +01 etc.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
What is regular expression so that user can enter any integer or float number between 1-99.
For entering only integer I know regular expression is:
^(0?[1-9]|[1-9][0-9])$
Please tell me RE for entering integer as well as float numbers between 1-99.
A simple version is ^[1-9][0-9]?$ for integers and ^([1-8][0-9]?|9[0-8]?)\.\d+$ for floats. If you want one for both: ^(([1-8][0-9]?|9[0-8]?)\.\d+|[1-9][0-9]?)$
Test it here
Try [1-9][0-9]?(.[0-9]*)?
Edit: The above include 99.something too. This shouldn't:
[1-9](([0-8](\.[0-9]*)?)|[0-9])?
Test it here, it works. ;)
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I have a string and I want to use replace() to remove some characters without losing character value, including spacing.
Here is an example:
Extremely Dissatisfied_______________________________________Extremely Satisfied
I want to use replace on this string:
<cfoutput>
#REPLACE("#attributes.question.questionsub#","_","","ALL")#
</cfoutput>
To get something like
Extremely Dissatisfied Extremely Satisfied
but instead I am getting this:
Extremely DissatisfiedExtremely Satisfied
I found the answer:
<cfoutput>
#REPLACE("#attributes.question.questionsub#","_"," ","ALL")#
</cfoutput>
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
[a-zA-Z0-9-_]{3,} this is my currently using regular expression in login page. I would like to allow space in the regexp. How can i do it? I'm lack of knowledge in RegExp.
This is just a character class, so just add space at the end of the class: [a-zA-Z0-9_ -]{3,}
How about:
[a-zA-Z0-9-_\s]{3,}
This will allow all forms of whitespace...