in reply to regex question

Add use re 'debug'; or perl -Mre=debug myfile.pl and you can get output like
#!/usr/bin/perl -- use strict; use warnings; use re 'debug'; my $str = "Test*.Value"; print "$1 $2\n" if($str=~/(.*?)\*(.*?)/); __END__ Compiling REx `(.*?)\*(.*?)' size 17 Got 140 bytes for offset annotations. first at 4 synthetic stclass `ANYOF[\0-\11\13-\377{unicode_all}]'. 1: OPEN1(3) 3: MINMOD(4) 4: STAR(6) 5: REG_ANY(0) 6: CLOSE1(8) 8: EXACT <*>(10) 10: OPEN2(12) 12: MINMOD(13) 13: STAR(15) 14: REG_ANY(0) 15: CLOSE2(17) 17: END(0) floating `*' at 0..2147483647 (checking floating) stclass `ANYOF[\0-\1 +1\13-\377{unicode_all}]' minlen 1 Offsets: [17] 1[1] 0[0] 4[1] 3[1] 2[1] 5[1] 0[0] 6[2] 0[0] 8[1] 0[0] 11[1] 1 +0[1] 9[1] 12[1] 0[0] 13[0] Guessing start of match, REx `(.*?)\*(.*?)' against `Test*.Value'... Found floating substr `*' at offset 4... Does not contradict STCLASS... Guessed: match at offset 0 Matching REx `(.*?)\*(.*?)' against `Test*.Value' Matching stclass `ANYOF[\0-\11\13-\377{unicode_all}]' against `Test*.V +alue' Setting an EVAL scope, savestack=5 0 <> <Test*.Value> | 1: OPEN1 0 <> <Test*.Value> | 3: MINMOD 0 <> <Test*.Value> | 4: STAR Setting an EVAL scope, savestack=5 REG_ANY can match 4 times out of 4... 4 <Test> <*.Value> | 6: CLOSE1 4 <Test> <*.Value> | 8: EXACT <*> 5 <Test*> <.Value> | 10: OPEN2 5 <Test*> <.Value> | 12: MINMOD 5 <Test*> <.Value> | 13: STAR Setting an EVAL scope, savestack=5 5 <Test*> <.Value> | 15: CLOSE2 5 <Test*> <.Value> | 17: END Match successful! Test Freeing REx: `"(.*?)\\*(.*?)"'
Another helpful tool is YAPE::Regex::Explain
#!/usr/bin/perl -- use YAPE::Regex::Explain; print YAPE::Regex::Explain->new(qr/(.*?)\*(.*?)/)->explain,$/ __END__ The regular expression: (?-imsx:(.*?)\*(.*?)) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- .*? any character except \n (0 or more times (matching the least amount possible)) ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- \* '*' ---------------------------------------------------------------------- ( group and capture to \2: ---------------------------------------------------------------------- .*? any character except \n (0 or more times (matching the least amount possible)) ---------------------------------------------------------------------- ) end of \2 ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------