Colin F
08-04-2004, 10:46 AM
Hi
I'm trying to get these stupid regular expressions to work on profile fields.
Could someone check these, I seem to have something wrong in them.
Postcode (4 Numbers, first 1-9, second, third and fourth 0-9)
/^[1-9][0-9]{3}$/
Telephone number In the format: 062/775 12 34 or 01/775 56 78
So that means: First digit: 0
second digit: 1-9
third digit (optional) 1-9
than a backslash: /
fourth digit: 1-9
fifth and sixth digit: 0-9
then a space:
seventh and eighth digit: 0-9
then a space:
ninth and tenth digit: 0-9
I have this:
/^[0]?[0-9]\/[1-9][0-9]{2}\s[0-9]{2}\s[0-9]{2}$/
Mobile Phone Number: In the format: 076/123 45 67
first digit: 0
second digit: 7
third digit: 6, 8 or 9
then a backslash: /
fourth digit: 1-9
fifth and sixth digit: 0-9
then a space:
seventh and eighth digit: 0-9
then a space:
ninth and tenth digit: 0-9
I have:
/^07[6-9]\/[1-9][0-9]{2}\s[0-9]{2}\s[0-9]{2}$/
Thanks for your time!
I'm trying to get these stupid regular expressions to work on profile fields.
Could someone check these, I seem to have something wrong in them.
Postcode (4 Numbers, first 1-9, second, third and fourth 0-9)
/^[1-9][0-9]{3}$/
Telephone number In the format: 062/775 12 34 or 01/775 56 78
So that means: First digit: 0
second digit: 1-9
third digit (optional) 1-9
than a backslash: /
fourth digit: 1-9
fifth and sixth digit: 0-9
then a space:
seventh and eighth digit: 0-9
then a space:
ninth and tenth digit: 0-9
I have this:
/^[0]?[0-9]\/[1-9][0-9]{2}\s[0-9]{2}\s[0-9]{2}$/
Mobile Phone Number: In the format: 076/123 45 67
first digit: 0
second digit: 7
third digit: 6, 8 or 9
then a backslash: /
fourth digit: 1-9
fifth and sixth digit: 0-9
then a space:
seventh and eighth digit: 0-9
then a space:
ninth and tenth digit: 0-9
I have:
/^07[6-9]\/[1-9][0-9]{2}\s[0-9]{2}\s[0-9]{2}$/
Thanks for your time!