$test =~ s{  (.*?)  [(]   (.*?)   [)]  }
         {<a href="$2" alt="$2">$1</a>}xmsg;

Just a .02 via an FYI :)

That looks pretty cool.  Using 'x' allows whitespace use, correct?


Correct.


And 'm' and 's' are ways of telling Perl how to interpret a line, right?


The /m option defines what the ^ and $ anchors match but you aren't using
those anchors.  The /s option defines what . matches so your regular
expression will match something different than before.

Good catch :) Although "Best Practice" recommends xms all the time so that you get used to writing it/writing for it. Sorry I forgot to mention th . difference

Can you tell me what the function of the square-brackets are for regexps? How are they different than regular parens?


'[' and ']' define a character class, but you don't really need a character
class in your example.

Again, just recommending "Best Practice" :)

perldoc perlre

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to