Tom Allison wrote:
I'm trying to capture the base URL and "everything after that" into two
arguements for all web page elements related to href and src properties
in tags.
EG:
<a href = "http://www.google.com/">
would return 'www.google.com' and '/'
So I tried this:
$string =~ m|(?:href|src)\W+(?:http://)?([^/]*)(/[^'"]*)(?:['"])|gsm
But it's not working very well.
I get this error
Unmatched ( in regex; marked by <-- HERE in m/( <-- HERE ?:href/ at
http_filter.t line 14.
I also tried: m|(?:(src|href)) with similar results.
I'm not sure anymore....
I thought this would have been relatively easy.
help?
OK, I'm NOT INSANE... or maybe I am and I just don't realize it.
Breaking it down I get this:
$string =~ /(?:(A|B))/ WORKS!!!!
$string =~ m|(?:(A|B))| DOES NOT WORK
$string =~ m%(?:http://)%; ALSO WORKS....
What's the magic screw-up that I'm pulling when I try to make a match with
m| | instead of m% % or / / ?????
This is weird. This is also probably a really good question because I see a lot
of people use m| | in their code and I don't know the pitfall...
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>