Posted on 2003-04-01
Ok, I want to parse a url. I want to take out an optional "http" an I'm not quite sure how to do it. Is there anyway to group the "http" so that you can add a "?" after it (making it optional)?
Also, I'm having a problem using "*." with matching. Say I have a string which I get from a text datafile "$name=Me&password=mypass&address=myaddress&status=active&hobby=computer design" and I want to change just the address field, but I don't know if the field are always going to be the same in the same order. So I try:
$string =~ s/&address=.*&/&$address=newaddress&/i;
But the .* will make it continue to the last "&". Any suggestions?