JupiterHost.Net wrote:


$text =~ s!(.*?)\((.*?)\)!<a href="$2" alt="$2">$1</a>!g;



Thanks for the help and the more streamlined regexp.


An even better way (see O'reilley's "Perl Best Practices" by Damian Conway - buy this book you will write better code)

Is to make it extremely readable with xms :)

Same exact regex as above:

$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? And 'm' and 's' are ways of telling Perl how to interpret a line, right? Can you tell me what the function of the square-brackets are for regexps? How are they different than regular parens?

Thanks,
Adam

--
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