Hi guys,
Have been trawling the web for quite some time with no luck - hopefully somebody can help!
I have a regular expression that checks for a suitably formatted email address, and I have a seperate process for catching blanks. Therefore I need a regex that accepts either a valid email address or no data at all.
Here's my existing regex...
From web searching I gather that I can use the | (pipe) character to seperate two arguments in a regex, but I'm unclear on the syntax, this is what I tried...PHP Code:if(!ereg('^[0-9A-Za-z.-_]+@[0-9A-Za-z]+\.[A-Za-z.]+$',$value)) $badFormat = 1;
... but it didn't work - as didn't countless other variations!PHP Code:if(!ereg('^[0-9A-Za-z.-_]+@[0-9A-Za-z]+\.[A-Za-z.]+$'|'^[A-Z]{4}$',$value)) $badFormat = 1;
Can somebody help me?
Thanks in advance!
Chris.




Reply With Quote



Bookmarks