|
Posted by Leonard Burton on 11/16/05 05:39
HI Curt,
Thanks for the reply,
> What does a amateur radio callsign look like? And in what context
> are you trying to parse this callsign?
Basically here is the regex I used (I am not the best with regexes):
$pattern = "/^[0-9]?[A-Z]{1,2}[0-9][A-Z]{1,3}/";
Here are how they look
W1W
W1AW
WA1W
AD4HZ
N9URK
WB6NOA
4N1UBG
I guess this would be better?
$pattern = "/^";
$pattern .= "([0-9][A-Z][0-9][A-Z]{3})|"; //4N1UBG
$pattern .= "([A-Z][0-9][A-Z]{1,3})|"; //N9URK, W1AW, W1W
$pattern .= "([A-Z]{2}[0-9][A-Z]{1,3})"; //WB6NOA, AD4HZ, WA1W
$pattern .= "/";
I am still trying to master regexes. Is there a better way to do this?
THanks,
--
Leonard Burton, N9URK
leonardburton@gmail.com
"The prolonged evacuation would have dramatically affected the
survivability of the occupants."
Navigation:
[Reply to this message]
|