in reply to simple regEx

As Corion pointed out, (.*) does not function as a capture inside \Q...\E.... but note, also, that if it did, so too would the empty pair of parentheses immediately after "cs". AFAIK (and as far as I can tell from some limited experimentation after reading your post), the regex engine does not squawk (OUT LOUD!) about an empty capture spec.

What's more, you are already using escape characters -- in the string assigned to $line.Have you carefully considered your requirement that the regex not use the same tool?

Updated with code and output after of some testing while *STILL* making myself crazed: Anyone see a problem here?
(and, please, find no fault with those who cast 3 upvotes, before I committed this [questionable] update)


#!C:/perl/bin use strict; use warnings; use vars qw ($line $line1 ); $line= "onmouseout=\"cs()\">Otani <b>Restaurant</b> &amp; <b>Sushi</b> + Bar: <b>Columbus</b> <b>Ohio</b> DiningGuide \ <b>Restaurant</b>...</a>csdkjfhasdkjghlkjhdfgkj"; print "Demonstrate that line_extending_slash after 'Dining Guide ' is +not an issue:\n" . $line . "\n\n"; &OP_mod ($line); &one ($line); &two ($line); &Corion ($line); # and a final test: $line1 = "now is the time for all good men..."; if ( $line1 =~ /()/ ) { print "\n In 'final test' at line 21, \$1 is : |$1| \n"; } else { print "no match on empty parens\n"; } print "done\n"; exit (1); ######### sub OP_mod # after Corion, placing \QE differently and using || fo +r match delimiters { if ( $line =~ m|onmouseout=\Q"cs()"\E>(.*)</a>| ) { print "\t \$1 is: $1\n"; } else { print "No match in sub OP_mod\n"; } return (); } sub one { if ( $line =~ m|onmouseout=.cs.{3}>(.*)</a>| ) # 3 chars between "cs" + and ">" -- (, ), and escaped double_quote { print "\t \$1 is: $1\n"; } else { print "No match in sub one\n"; } return (); } sub two { if ( $line =~ m|cs().>(.*)\Q</a>\E| ) { print "\t,in sub two, \$1 is: $1 and \$2 is $2\n"; } else { print "No match in sub two\n"; } return; } sub Corion { if ( $line =~ m@\Qonmouseout="cs()">\E(.*)\Q</a>\E@ ) { print "in subCorion, \$1 is: $1\n"; } else { print "No match in subCorion\n"; } # next two lines, uncommented, return exact original of $line, less th +e trailing line_extending_slash $line =~ m@\Qonmouseout="cs()">\E(.*)\Q</a>\E@; print "\n -- \$line after exact replica of Corion's: $line \n"; return; } =HEAD output under w2k, perl v 5.8.6, with CLI (DOS) window set to wid +th = 255 C:\_perl\pl_test>perl r1109.pl Demonstrate that line_extending_slash after 'Dining Guide ' is not an +issue: onmouseout="cs()">Otani <b>Restaurant</b> &amp; <b>Sushi</b> Bar: <b>C +olumbus</b> <b>Ohio</b> DiningGuide <b>Restaurant</b>...</a>csdkjfhasdkjghlkjhdfgkj No match in sub OP_mod No match in sub one No match in sub two No match in subCorion -- $line after exact replica of Corion's: onmouseout="cs()">Otani <b> +Restaurant</b> &amp; <b>Sushi</b> Bar: <b>Columbus</b> <b>Ohio</b> Di +ningGuide <b>Restaurant</b>...</a>csdkjfhasdkjghlkjhdfgkj In 'final test' at line 21, $1 is : || done C:\_perl\pl_test> =cut