I don't understand why this would grab more than what is wanted. It seems to me that the [^>]* will grab everything that isn't a '>', so it'll grab stuff until we finally get to the first instance of '>'. Even though it is greedy, I don't think it would grab past the '>' of the '<body ... >' tag. Care to expand?
$ perl -e 'my $str = "<body something=\"yep\"><a href=\"..\">"; $str = +~ s/<body[^>]*>/<body>/; print "$str\n"' <body><a href=".."> $
-Bryan
In reply to Re^3: Regular Expressions
by mrborisguy
in thread Regular Expressions
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |