Dear Perl experts, I'm trying to find the right regular expressions to do some simple (?) string processing. Can anyone tell me how to do these?
1. Given a string consisting of substrings delimited by colons, such as :B520:L201:M:M260:8:G607:, how can I a. remove the single-character and all-numeric substrings (M and 8 in this example), leaving the rest alone? b. remove all but the single-character and all-numeric substrings and leave the rest alone? c. remove all but single- or double-character substrings and all-numeric substrings and leave the rest alone? The string will never have regex metacharacters in it, just mixed alpha and numeric, all-alpha, or all-numeric. The colons can stay. 2. Is there an easy way to count the number of substrings (the "chunks" between colons)? 3. This one is probably a bit difficult. I don't need to have it, but it would save me lots of effort if I had it. Given two strings of the same form as in no. 1, is there a regular expression which can compare the two and return the number of substring positions which have exact matches? I.e., given string 1 = :L000:W000:M:M260:G607: and string 2 = :L001:W000:M:M261:M260: can match the substrings and their positions and return the result "2" in this case? The M260 substring is present in both but in different positions and shouldn't be counted as a match. Thanks in advance for your help! Scott Scott E. Robinson data SWAT Team UTC Onsite User Support RR-690 -- 281-654-5169 EMB-2813N -- 713-656-3629 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]