in reply to Re: help with regexin thread help with regex
while(<DATA>) { chomp; if (/string=\"(\d+)\"|static-address\/(.*?)\"/) { my $id = $1 ? $1 : $2; print "ONE: $id\n"; } } __DATA__ static string="123456" containing numbers html value <a href="static-address/foo">text</a> [download]
if (/string=\"(\d+)\"|static-address\/(.*?)\"/) { my $id = defined($1) ? $1 : $2; [download]
And then there's this:
if (/string=\"(\d+)\"/ || /static-address\/(.*?)\"/) { my $id = $1; [download]