Re: Regex for Amateur Radio Callsigns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx


"The prolonged evacuation would have dramatically affected the
survivability of the occupants."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux