in reply to Weird? regex Question
When run (actually, when compiled), you get this output:#!/usr/local/bin/perl -w use strict; use re 'debug'; "xyz" =~ /arbITRary CharS ($|--$)/;
OPEN1(9) corresponds to the opening (capturing) bracket. It's followed by one of two BRANCHes: EOL (given by $) or EXACT <--> and an EOL (given by --$).compiling RE `arbITRary CharS ($|--$)' size 17 first at 1 1: EXACT <arbITRary CharS >(7) 7: OPEN1(9) 9: BRANCH(11) 10: EOL(15) 11: BRANCH(15) 12: EXACT <-->(14) 14: EOL(15) 15: CLOSE1(17) 17: END(0) anchored `arbITRary CharS ' at 0 (checking anchored) minlen 16
So Perl can tell you exactly what it thinks you mean by your regular expression.
use re 'debug' also prints out information about the match, but in this case we don't care about it...
|
|---|