It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
How would you construct a regex matching a password that must consist of 6 to 16 characters and contain at least one number or special character?
You need to define what constitutes special characters for you.
Something like this regex should work:
(?=^.*?[\d#;:'"()`~#!%$&=-])^.{6,16}$
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
and there are exactly 3 integers. No floats allowed. No characters allowed. Just integers.
The pattern for that is this: \d+\s*,\s*\d+\s*,\s*\d+
Matches three digits with any number of spaces
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
\\s*[\\-]?[\\d]{1,3}\\s+[\\-]?[\\d]{1,3}\\s+[\\-]?[\\d]{1,3}\\s+[\\-]?[\\d]{1,3}\\s*
I have this regex for taking in 4 coordinates which are whole numbers (positive or negative). Can you please suggest any bugs in this regex?
If it's a Java regex, then it's correct for matching a string that contains four integer numbers between -999 and 999, separated by whitespace. It's very ugly, though, and could be simplified a lot:
\\s*(?:-?\\d{1,3}\\s+){3}-?\\d{1,3}\\s*
If it's not Java, then you only need one backslash at a time (but you might need other syntax, depending on your language).
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I want a regular expression for using it in ASP.NET. It should be of 10 alphanumeric digits. The first 5 characters are letters, next 4 numerals and last character letter.
that should do the trick
^[a-zA-Z]{5}[0-9]{4}[a-zA-Z]$
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Need regex for 0|1, except the letters can't repeat.
So:
101010 - valid
010101 - valid
110011 - invalid
Well, this is pretty trivial:
(?=[01])0?(?:10)*1?
1?(01)*0? // matches alternating 1s and 0s
^1?(01)*0?$ // same as above but only whole strings
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Can you specify that it must do one or the other?
If it's an inclusive OR, sure:
/(?:^1234|gmail\.com$)/
If it's an exclusive OR, the simplest way is to do it with two expressions: test whether it matches exactly one of /^1234/ or /gmail\.com$/.