Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

PHP eregi function

  1. Oct 31, 2007 #1

    Hootenanny

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Hi all,

    I have this xml xsd pattern defintion;

    Code (Text):
    [A-Z,0-9]{5}[0-9][0,1,5,6][0-9]([0][1-9]|[1-2][0-9]|[3][0,1])[0-9][A-Z,0-9]{3}[A-Z]{2}
    and I need to convert it into an ereg regular expression to valid some input from a form. I've been at this for hours but can't seem to get anywhere. Can any of you guys help out...?
     
  2. jcsd
  3. Oct 31, 2007 #2

    jim mcnamara

    User Avatar
    Science Advisor
    Gold Member

    This is an extended "legal" regex:
    Code (Text):

    /[A-Z,0-9]{5}[0-9][0,1,5,6][0-9]\([0][1-9]|[1-2][0-9]|[3][0,1]\)[0-9][A-Z,0-9]{3}[A-Z]{2}/
     
    But I have no way of knowing if it works or even finds what you need. I added /'s to test the grammar
     
  4. Oct 31, 2007 #3

    Hootenanny

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    The slashes worked Jim, thanks alot! FYI I'm using the regex to verify UK driving license numbers. Thanks again.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: PHP eregi function
  1. PHP Help ? (Replies: 16)

  2. Php or c++ ? (Replies: 40)

Loading...