This question already has answers here:
Regex to match only letters
(20 answers)
Closed 9 years ago.
I was looking for a regex that can validate phone numbers, but somehow i cannot find a universal solution.
So i just want to check if the string has any alphabets that is a-z
If it does not then pass it, for example
000 -> Pass
000(1) -> Pass
000a -> Fail
(?mx)^(?=.*?([0-9]))((?![a-zA-Z]).)*$
This will check to see if your line has any numbers in it while NOT having any alpha chars. See the example here.
its for phone numbers validation
RegExp(/^[0-9 +()-]{3,30}$/i)
for only string
RegExp(/^[a-zA-Z]{1,2}$/i)
Related
This question already has answers here:
How to validate phone numbers using regex
(43 answers)
Closed 2 years ago.
I have a TextFormField for a phone number and I want to validate the input to match my RegEx to phone number value
the valid inputs are
075xxxxxxxx
077xxxxxxxx
078xxxxxxxx
079xxxxxxxx
I tried this r"^ (?:[0]7)?[0-9]{11}$" but its not working
any way to do it right?
Match a zero, then a 7, then any of [5,7,8,9] then any 8 digits:
07[5789]\d{8}
This question already has answers here:
Regex for Australian phone number validation
(5 answers)
Closed 4 years ago.
The below expression is being used to accept Australian phone numbers.
I need to change the expression as to strictly accept total 10 digits (without spaces) if the number starts with 02/03/04/07/08.
^\({0,1}((0|\+61)\s?(2|4|3|7|8)){0,1}\){0,1}(\ |-){0,1}[0-9]{2}(\ |-){0,1}[0-9]{2}(\ |-){0,1}[0-9]{1}(\ |-){0,1}[0-9]{3}$
It does accept 10 digits if the number is entered like 03 11 11 1 111, but without spaces 8 digit number is accepted too.
You can use the use the following regex with alternation:
^ *(?:0 *[23478](?: *\d){8}|[1-9](?: *\d)*|0 *[01569](?: *\d)*) *$
Demo: https://regex101.com/r/bet7m1/1
This question already has answers here:
How do I match an entire string with a regex?
(8 answers)
Regex.Match whole words
(4 answers)
Closed 5 years ago.
I'm trying to match a pattern in powershell, any 3 letters followed by any 2 numbers, example: abc00
Trying:
'abc00' -match '[a-zA-Z]{3}[0-9]{2}'
returns TRUE
but :
'abcdefg0000' -match '[a-zA-Z]{3}[_0-9]{2}'
also returns TRUE.
How do I limit it so if the string doesn't contain exactly 3 letters and 3 numbers, it returns false?
Thank you!
This question already has answers here:
Regular expression to match a line that doesn't contain a word
(34 answers)
Closed 6 years ago.
I have several lines win one word in each in my Notepad++. How to select all words not not containing Set ant Get phrase.
SetBlaBla1
BlaGetBla2
BlaBla3
Result should be BlaBla3
Try negative look-ahead, something like this:
^((?!Set|Get).)*$
This question already has answers here:
Extract a single (unsigned) integer from a string
(23 answers)
Closed 3 years ago.
I can't figure out how to find a digit in a string like the following: Picture15.jpg. Does anyone have a RegEx of how to extract this digit in PHP?
Try
preg_match("/(\d+)/", "Picture15.jpg", $m);
echo $m[1];