Quote:
Originally Posted by KevinADC
Not sure I understand your question, but maybe:
Hi Kevin - Look at example 5
here I spent a couple of hours looking at it before I gave up. The author managed to extract 4 strings all at once with this single line of perl code
$url =~ m|(\w+)://([^/:]+)(:\d+)?/(.*)|;
ie: $1, $2, $3 and $4 were assigned in the above statement.
I was trying to do the same thing ie: all in one line of code. However most of the code examples I see (perl) are what I consider cryptic and extracting one variable at a time on each line (like I showed in my original post) is easier to read and only took a few minutes to code once I understood how (.*?) worked.
The problem I had with example 5 is in figuring out how to arrange the multiple () as I needed two of them so as to extract tnow and ttok into $1 and $2
Currently, I have found it is a lot easier to use split to extract strings I want but I would like to get up to speed on regular expressions.