On 11/04/2011 03:56 PM, Chris Stinemetz wrote:



Try this:

"Cell 999 CDM 1, 2, CBR 1, 15MHz, HEH" =~ /Cell\s*(\d+)\s*(.*),\s*HEH/;
print "<$1>  <$2>\n";




Thank you Jim. This did the trick! Do you mind explaining how you did this?
I'm trying to make sense of it with my perl regex cheat sheet I found
online.

http://www.erudil.com/preqr.pdf

a good rule is to not search the web for perl help. there is too much bad info out there. that cheat sheet is from 2002. it is incredibly out of date and is missing so many commonly use features. it actually will limit your regex skills if you rely on it.

perl has several docs on regexes including perlrequick which covers much of that cheat sheet material but with explanations. perlretut is a tutorial and perlre is the complete reference on regexes. consult them before you look at other things. also there is a very good book, mastering regular expressions, (even the first edition which is old, is useful and probably available very cheaply used). if you are going to be using regexes (and if you are coding in perl you will be), you have to learn them. the regex you wanted isn't that complex and you should be able to do that one on your own. read those docs and optionally the book and you will get there.

uri

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to