Using PHP eregi Function - Solve XML XSD Pattern Definition

In summary, the conversation involves someone seeking help converting an XML XSD pattern into an ereg regular expression for validating input from a form. After struggling for hours, another person suggests using an extended "legal" regex with added slashes to test the grammar. The person seeking help confirms that it works for verifying UK driving license numbers.
  • #1
Hootenanny
Staff Emeritus
Science Advisor
Gold Member
9,623
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...?
 
Technology news on Phys.org
  • #2
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
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 alot! FYI I'm using the regex to verify UK driving license numbers. Thanks again.
 

Related to Using PHP eregi Function - Solve XML XSD Pattern Definition

1. What is the purpose of the PHP eregi function?

The PHP eregi function is used to perform case-insensitive regular expression matching. It is commonly used for pattern matching and data validation.

2. How do I use the eregi function to solve XML XSD pattern definition?

To use the eregi function for XML XSD pattern definition, you will need to pass in the regular expression pattern as the first parameter and the string to be matched as the second parameter. The function will return a boolean value indicating whether the string matches the pattern or not.

3. Can the eregi function be used for XML XSD pattern definition with namespaces?

Yes, the eregi function can be used for XML XSD pattern definition with namespaces. However, you will need to make sure that the regular expression pattern accounts for the namespace prefix in the string being matched.

4. Are there any limitations to using the eregi function for XML XSD pattern definition?

One limitation of using the eregi function for XML XSD pattern definition is that it only supports case-insensitive matching. This means that it may not be suitable for more complex patterns that require case-sensitive matching.

5. Can the eregi function be used for XML XSD pattern definition in all versions of PHP?

No, the eregi function is deprecated as of PHP 5.3.0 and has been removed in PHP 7.0.0. It is recommended to use the preg_match function instead, which provides more features and better performance.

Similar threads

  • Programming and Computer Science
Replies
17
Views
2K
  • Programming and Computer Science
Replies
12
Views
1K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
12
Views
1K
Replies
6
Views
2K
  • Programming and Computer Science
Replies
11
Views
1K
  • Programming and Computer Science
Replies
3
Views
2K
  • Programming and Computer Science
Replies
2
Views
2K
  • Calculus and Beyond Homework Help
Replies
8
Views
1K
  • Programming and Computer Science
Replies
7
Views
5K
Back
Top