PHP eregi function

  • PHP
  • Thread starter Hootenanny
  • Start date
  • #1
Hootenanny
Staff Emeritus
Science Advisor
Gold Member
9,622
6

Main Question or Discussion Point

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...?
 

Answers and Replies

  • #2
jim mcnamara
Mentor
3,909
2,299
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
 
  • #3
Hootenanny
Staff Emeritus
Science Advisor
Gold Member
9,622
6
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 alot! FYI I'm using the regex to verify UK driving license numbers. Thanks again.
 

Related Threads on PHP eregi function

  • Last Post
Replies
4
Views
3K
Replies
2
Views
1K
  • Last Post
Replies
4
Views
635
  • Last Post
Replies
6
Views
3K
  • Last Post
Replies
8
Views
6K
  • Last Post
Replies
8
Views
4K
  • Last Post
2
Replies
40
Views
19K
  • Last Post
Replies
12
Views
838
  • Last Post
Replies
9
Views
1K
Replies
4
Views
3K
Top