in reply to A Regex simple Question
I'd split it into two matches:
while ( <DATA> ) { chomp; print "$_: ", /^a.*b$/ && !/.ab./ ? "yes" : "no", "\n"; } __DATA__ a000000000b a0a0000b00b a0000ab000b ab00000000b a000ab
Output:
a000000000b: yes a0a0000b00b: yes a0000ab000b: no ab00000000b: yes a000ab: yes
update: Added two more tests cases and fixed a bug
|
|---|