HI Curt, > > W1W > > W1AW > > WA1W > > AD4HZ > > N9URK > > WB6NOA > > 4N1UBG > Ok, so i can conclude so far we have alpha numeric chars minimum of > 3 chars up to 6, this would make a regex: > /[A-Z0-9]{3,6}/ The only problem with this is that it would take "444" which is not a valid call. > > $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? > > For one trying to master regex's you seem to have a good grasp on > it. Thanks for the support. I think I can do regex's pretty well but I do not have a mastery of them yet. > If this pattern works according to the specs of a callsign, it > should work fine. You could try to combine the regex into one > statment (without the | condition) but that would make the regex > rather ugly. I am looking for a regex that I can use for both preg_split and preg_match. I have not yet really learned how to do preg_splits yet. I am still trying to figure out what in the world to do. I have done some preg_splits and I know enought to know that if you have more than one set of () that will return on an expression then it will royally mess things up. > One thing i would suggest, although probably a minor issue > considering how long the string is, is to make sure you put the > most likely match in your first pattern to match. Actually that is a good suggestion. I can see how it would make things more efficent. Should you order the whole expression in terms of how likely it is to get a result? (i.e. "/^(most)|(frequent)|(least)/") Thanks for the help! -- 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