Ing. Branislav Gerzo schreef: > I need small regexp help, I'm doing webpage, where I rewrite all links > in XML according weblang parameter.
#!/usr/bin/perl use strict; use warnings; { local ($,,$\) = ("\t", "\n"); my $orig = " Foo and Bars Link='http://example.com/' Foo and Bars Foo and Bars Link='http://example.com/#anchor' Foo and Bars Foo and Bars Link='http://example.com/foo.php#anchor' Foo and Bars Foo and Bars Link='http://example.com/foo.php?id=10¶m=1#anchor' Foo and Bars "; my $work = $orig; s~('http:[^?']*)\?([^']*')~$1&$2~mg , s~('http://example.com/)([^#&'\n]*)([^#'\n]*)([^']*')~$1$2?weblang=sk$3$ 4~mg for $work; my $goal = " Foo and Bars Link='http://example.com/?weblang=sk' Foo and Bars Foo and Bars Link='http://example.com/?weblang=sk#anchor' Foo and Bars Foo and Bars Link='http://example.com/foo.php?weblang=sk#anchor' Foo and Bars Foo and Bars Link='http://example.com/foo.php?weblang=sk&id=10¶m=1#anchor' Foo and Bars "; print $orig; print $work; print $goal; print 'It works!' if ($work eq $goal); } -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>