Re: Regex for Amateur Radio Callsigns

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

 



Leonard Burton wrote:
HI,


Tuesday, November 15, 2005, 8:39:19 PM, you wrote:

Here are how they look
W1W
W1AW
WA1W
AD4HZ
N9URK
WB6NOA
4N1UBG

Let's do it this way... What are the rules for a valid callsign?


Basicly, you see an example of each different type of callsign.  Other
than the patterns you  see above there are no real rules.  A letter in
the example above means that there can only be a letter in the spot
and a number in a spot means there can only be a number in that spot. There are 7 different formats and you see the one above.

Did you see the regex I had in a previous post?

/^([A-Z]{1,2}|[0-9][A-Z])([0-9])([A-Z]{1,3})$/

Using preg_match(), this will split a callsign like N8LAI into

array(
 0 => 'N8LAI',
 1 => 'N',
 2 => '8',
 3 => 'LAI'
)

and you can use the information however you like (i.e. this is a standard technician/general class call sign, located in region 8 Michigan/Ohio/Kentucky, etc.)

_... .
Greg

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