Using PHP eregi Function - Solve XML XSD Pattern Definition

  • Context: PHP 
  • Thread starter Thread starter Hootenanny
  • Start date Start date
  • Tags Tags
    Function Php
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 8K views
Messages
9,621
Reaction score
9
Hi all,

I have this xml xsd pattern defintion;

Code:
[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...?
 
Physics news on Phys.org
This is an extended "legal" regex:
Code:
/[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
 
jim mcnamara said:
This is an extended "legal" regex:
Code:
/[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
The slashes worked Jim, thanks a lot! FYI I'm using the regex to verify UK driving license numbers. Thanks again.