locked
regular expression for Iraq phone number RRS feed

  • Question

  • i want a regular expression for Iraq phone numbers for ASP.net
    example:
    00964 xxx xxxxxxx
    +964 750 4000000
    +964 770 0000000
    Saturday, March 17, 2012 5:42 PM

Answers

  • On Sat, 17 Mar 2012 17:42:40 +0000, Bayar Duhoki wrote:
     
    >i want a regular expression for Iraq phone numbers for ASP.net
    >example:
    >00964 xxx xxxxxxx
    >+964 750 4000000
    >+964 770 0000000
     
    I'm not sure how much of the Iraq specification you want to match.  Your first line shows an initial double zero, your second and third show the +
    To match your examples, you can try    (?:\+|00)964\s\d{3}\s\d{7}\b
     
    To match the possible codes for Iraq, as listed in Wikipedia, http://en.wikipedia.org/wiki/Telephone_numbers_in_Iraq you can try:
     
    964\s*(?:1|2[1345]|3[02367]|4[023]|5[03]|6|026]|0?7[3-9]\d)\s*\d{3}\s*\d{3,4}\b
     
    Note that this last does not match anything prior to the country code.
     
    If you want something else, you'll need to be more specific.
     

    Ron
    Saturday, March 17, 2012 7:13 PM

All replies

  • On Sat, 17 Mar 2012 17:42:40 +0000, Bayar Duhoki wrote:
     
    >i want a regular expression for Iraq phone numbers for ASP.net
    >example:
    >00964 xxx xxxxxxx
    >+964 750 4000000
    >+964 770 0000000
     
    I'm not sure how much of the Iraq specification you want to match.  Your first line shows an initial double zero, your second and third show the +
    To match your examples, you can try    (?:\+|00)964\s\d{3}\s\d{7}\b
     
    To match the possible codes for Iraq, as listed in Wikipedia, http://en.wikipedia.org/wiki/Telephone_numbers_in_Iraq you can try:
     
    964\s*(?:1|2[1345]|3[02367]|4[023]|5[03]|6|026]|0?7[3-9]\d)\s*\d{3}\s*\d{3,4}\b
     
    Note that this last does not match anything prior to the country code.
     
    If you want something else, you'll need to be more specific.
     

    Ron
    Saturday, March 17, 2012 7:13 PM
  • Hello,

    This might helps!

    You can get regular expression from following link:(Don't know that if you would find help for the Iraq numbers from here!!)

    Regular Expression Library

    You can verify that expression on following link.:

    Javascript Regular Expression Validator | Regular Expressions Library and Testing Tool

    Thursday, April 12, 2012 10:00 AM