I usually go to bed when most folks are getting up and sleep until about noon.

Oh, yes it's certainly possible. The expression will just be a little longer.

If your numbers have to start with

+31 or

+44, you would use

^\+31\d{8}$|^\+44\d{8}$ Regular expressions can be very complicated. I'm just really beginning to be able to understand them myself. There is a whole book on them. But I can explain the one above.

^ means "begins with"

+31 is one of the beginnings of your valid input. The

/ before the + is required because a + has some other meanings in regular expressions. This tells the script to look for the character and not to interpret it.

\d means "digits" -- or numbers.

{8} means that there has to be 8 of them. You have 10 numbers in your valid input, but you are already using two of them with your 31, so there must be 8 more.

$ means "ends with" so it won't accept anything that has more numbers or any letters or other characters after the 8 digits.

| means "or"

So, if I put the whole thing together, it means:

Begins with "+31" followed by exactly eight digits or begins with "+44" followed by exactly eight digits. If you have other possiblities, you can just add them on to the end, separated by a |. For example, if you wanted to allow phone numbers that started with "+41" you would add

|^\+41\d{8}$ You can make it as long as you need to.

JPD

http://www.jpdeni.com/dbman/