in reply to Regular Expresion
When you're dealing with something in a known/spec'd format, it's usually best to reach for a parser.
use URI; use URI::QueryParam; while ( <DATA> ) { chomp; my $uri = URI->new($_); print $uri, "\n"; for my $param ( qw( id username ) ) { printf(" %s --> %s\n", $param, join(", ", $uri->query_param($param)) ); } } __DATA__ http://beta.websitename.com/tool/view/mb/file?id=3323213&username=anir +udh007 http://beta.websitename.com/tool/view/mb/file?username=anirudh007&id=4 +3242342
See recent: url get variables regex
|
|---|