in reply to Regexp syntax nuance question, storing $1 (code)
So it can match lines like "#=#=#=#=#". Icky, no? Sadly, to get the regex to work like you'd expect, you have to do something like:1. OPEN 1 2. MATCH 'a' OR 'b' 3. CLOSE 1 4. TRY GOTO 1
sub zapwrap { my ($this, $next) = @_; return $this =~ m{ ^ \# # '#' at the beginning of the string ( [\#=] ) # a '#' or an '=' (saved to $1) \1* # that character 0 or more times $ # end of line }x and $next =~ m{ ^ # beginning of string $1+ # that character 1 or more times $ # end of string }x; }
|
|---|