regex for phone number format (with dot) [duplicate] - javascript

This question already has answers here:
How to validate phone numbers using regex
(43 answers)
Closed 8 years ago.
Can somebody give me the regex for validating the phone numbers 000.0000.000000 and also without the dots.
sample numbers
880.1817.087511
and
8801817087511

try this.
\b\d{3}[.]?\d{4}[.]?\d{6}\b

Related

How can I extract number from text with regular expression [duplicate]

This question already has answers here:
Get price value from a string
(7 answers)
Closed 3 years ago.
I am trying to extract number from title. I have title like this:
**
Apartment London, 230.400€, 450,00m2
**
I want to extract only this price number (230.400€), can anybody help me with this?
So far my code look like this
\d+\.?\d+(.)
You can include the amount symbol as part of your RegEx:
/\d+\.?\d+(.)€/
Or you can try using Positive lookahead:
\d+\.?\d+(.)(?=€)

How can I use regular expression for multiple values [duplicate]

This question already has answers here:
Comma Separated Numbers Regex
(6 answers)
Closed 6 years ago.
I am trying to generate a regex which would match the following sequence-
+911111111111,+912222222222,+913333333333,+914444444444
It should not allow any other character other than + and numbers
I have tried this->
/^(\+91)\d{10}$/
But it works only for one phone number not for multiple phone numbers
If
^\+\d{11}$
(a + followed by 11 digits) is not sufficient you'll need to be more specific about what you want to allow and not-allow.
Update following comment: the first two digits are "91" so those can be specified, and then ten further digits:
^\+91\d{10}$

Email regex with min length and not max length [duplicate]

This question already has answers here:
How can I validate an email address in JavaScript?
(79 answers)
Closed 8 years ago.
I have this regex in JavaScript:
new RegExp('^[0-9a-z._-]+#{1}[0-9a-z.-]{2,}[.]{1}[a-z]{2,}$','i');
and I want to modify it.
The last part of the mail must have a minimum value: 2 chars and no maximum length so I can put mails such as .localhost .paris .thisismyexample ...
How may I do that?
new RegExp('\b[A-Z0-9._%+-]+#(?:[A-Z0-9-]+\.)+[A-Z]{2,}\b','i');

Javascript telephone number validation [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Phone Number Validation Javascript
Hi I am creating validation for a form using javascript.
I am wanting to check the telephone number field using if statements to ensure it contains a 4 digit area code then a space followed by a 7 digit number.
Any help would be appreciated.
Thanks
So you need to validate something like 1234 1234567
function isValidTel(numberToTest){
var pattern =/^\d{4} \d{7}$/
return pattern.test(numberToTest);
}

regular expression phone number [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
A comprehensive regex for phone number validation
Can somebody give me the regex for phone number. It can be entered in the format of XXX-XXX-XXXX or (XXX)-XXX-XXXX or XX-XXX-XXXX or XXXXXXXXX
Heres what I have:
/\d{2,3}-\d{3}-\d{4}$/
Brute force/easily maintained/easily read/I think is what you have.
(\d\d\d\-\d\d\d\-\d\d\d\d)|(\(\d\d\d\)\-\d\d\d\-\d\d\d\d)|(\d\d\-\d\d\d\-\d\d\d\d)|(\d\d\d\d\d\d\d\d\d)
Or if you prefer:
(\d{3}\-\d{3}\-\d{4})|(\(\d{3})\-\d{3}\-\d{4})|(\d{2}-\d{3}\-\d{4})|(\d{9})
((\d{2,3}|\(\d{3}\))-\d{3}-\d{4}|\d{9})
Mostly you care about the digits:
/^([()-]*\d)[()-]*){9,10}$/.test(string);
or even
/^(\D*\d\D*){9,10}/.test(string);

Categories

Resources