Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 102
  • Last Modified:

Regular Expression- Range (telephone)

Hi,

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

Thanks.
0
ezzadin
Asked:
ezzadin
  • 2
  • 2
1 Solution
 
Terry WoodsIT GuruCommented:
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
 
ezzadinAuthor Commented:
Hi Terry,

Thanks. I tested the Regex using regexr.com and I'm only getting one match though.
0
 
Terry WoodsIT GuruCommented:
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
 
ezzadinAuthor Commented:
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!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now