You are here: Re: [PHP] Regex for Amateur Radio Callsigns « PHP « IT news, forums, messages
Re: [PHP] Regex for Amateur Radio Callsigns

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация