This question already has answers here:
Regex to validate password strength
(11 answers)
Closed 4 years ago.
What can be a valid regex for a password that contains at least 8 characters in which there should be one upper-case,one lower-case and one number?
Here is a regular expression for a string with at least 8 characters, one upper-case, one lower-case and one number.
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$
Related
This question already has answers here:
numbers not allowed (0-9) - Regex Expression in javascript
(6 answers)
Closed 2 years ago.
I am trying to create a react(javascript) form, In that one field should allow all values (Uppercase letters, Lowercase letters and special characters) but not numbers.
Is there any regex or any other solution?
Thanks in advance.
You can simply check that a string DOESN'T contain numbers using regex \d which matches all numbers:
!(/\d/.test(string))
This question already has answers here:
How to search for occurrences of more than one space between words in a line
(5 answers)
Closed 3 years ago.
Currently I'm using regex=/^(\w+\s?)*\s*$/, it's working fine for extra space, but failing for special characters.
Expectation:
regex.test('abcd ghh') => false
regex.test('abcd*') => true
You will need the last regex pattern of this solution.
[^\s]([ ]{2,})[^\s]
This question already has answers here:
Regex to check whether a string contains only numbers [duplicate]
(21 answers)
Closed 4 years ago.
I want a Javascript regex to replace only numbers i.e. all others alphabets and special characters are allowed.
This should do:
let string= "26kgsl5"
let newString = string.replace(/[0-9]/g, "");
console.log(newString);
This question already has answers here:
Reference - What does this regex mean?
(1 answer)
Using explicitly numbered repetition instead of question mark, star and plus
(4 answers)
Match exact string
(3 answers)
Closed 4 years ago.
I need to have a Regex for matching a single (or greater) non- blank space character (would allow all special characters such as !,' etc...). Would
var filter = /\S+/;
be sufficient? This seems to work for 1 or greater.
Would:
var filter = /\S+/{3,};
be sufficient for 3 or more of the non-same characters (like "def", "a!c", "dA!!f", but not "some bird"?
This question already has answers here:
I want to ignore square brackets when using javascript regex [duplicate]
(4 answers)
Closed 8 years ago.
I have a very simple form with this regex pattern set on my first/last name fields ng-pattern="/^[a-zA-z]{2,30}$/" and both fields accept this value as being valid e.g. Tester\^*&^%. The first/last name should only accept alpha character a-zA-Z with a minimum of 2 characters and a max of 30.
Here is the wrong thing.
^[a-zA-z]{2,30}$
^
|
It would match \^ symbols because these symbols are comes under the range from A to z.
Modified regex.
^[a-zA-Z]{2,30}$