Solved

Regular Expression- Range (telephone)

Posted on 2016-10-19
4
73 Views
Last Modified: 2016-10-19
Hi,

I need a regular expression code that identifies number between 8003966101 and 8003966150. Can someone help me with this?

Thanks.
0
Comment
Question by:ezzadin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 35

Expert Comment

by:Terry Woods
ID: 41851132
Pattern:
/80039661(0[1-9]|[1-4]\d|50)/

Open in new window


Depending on the language, the \ character may need escaping, and the pattern delimiters / may or may not need to be there.
0
 

Author Comment

by:ezzadin
ID: 41851185
Hi Terry,

Thanks. I tested the Regex using regexr.com and I'm only getting one match though.
0
 
LVL 35

Accepted Solution

by:
Terry Woods earned 500 total points
ID: 41851308
Can you save your test data there and provide a link? The "g" pattern modifier would normally cause multiple occurrences to be matched, ie
/80039661(0[1-9]|[1-4]\d|50)/g

Open in new window

but it looks like the tool at your given link may use that pattern modifier by default. It seems to work for me:
http://regexr.com/3efmc
0
 

Author Comment

by:ezzadin
ID: 41851311
I see. This is working great. Thanks.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Batuhan Cetin Regular expression is a language that we use to edit a string or retrieve sub-strings that meets specific rules from a text. A regular expression can be applied to a set of string variables. There are many RegEx engines for u…
As most anyone who uses or has come across them can attest to, regular expressions (regex) are a complicated bit of magic. Packed so succinctly within their cryptic syntax lies a great deal of power. It's not the "take over the world" kind of power,…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question