Regex problem

Discussion in 'Web Design and Development' started by John444, Sep 4, 2011.

  1. John444 macrumors member

    Joined:
    Feb 10, 2011
    #1
    I am having trouble learning regex!
    I cannot seem to get the right php regex to validate that an email that is in the form (xxx) xxx-xxxx

    I know the javascript regex is /\(\d{3}\) \d{3}\-\d{4}/ but what is the php regex?

    If anyone can give me the regex for this it would be appreciated
     
  2. John444 thread starter macrumors member

    Joined:
    Feb 10, 2011
    #2
    never mind I figured it out

    /^\(\d{3}\)\-\d{3}\-\d{4}$/
     
  3. elppa macrumors 68040

    elppa

    Joined:
    Nov 26, 2003

Share This Page