Hans Meier (John Doe) wrote: > John W. Krahn am Dienstag, 7. März 2006 00.12: >>Adam W wrote: >>>JupiterHost.Net wrote: >>>>>>$text =~ s!(.*?)\((.*?)\)!<a href="$2" alt="$2">$1</a>!g; > [...] >>>>Same exact regex as above: >>>> >>>>$test =~ s{ (.*?) [(] (.*?) [)] } >>>> {<a href="$2" alt="$2">$1</a>}xmsg; > [...] >>>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. > > just to sum up: > > $test =~ s{ (.*?) \( (.*?) \) } > {<a href="$2" alt="$2">$1</a>}xsg; > > - "\(" instead of "[(]": more readable
And more efficient. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>