So, a regex that actually matched "A line beginning and ending with zero or more letters in the set/class {a}" would be
I didn't touch that in my post because both /^.*\z/s and 1 would be sufficient to match "A line beginning and ending with zero or more letters in the set/class {a}".
If you wanted a regexp that matched "A line beginning and ending with one or more letters in the set/class {a}", you'd use
/^[a]/ && /[a]\z/ (Two regexps),
/^(?=[a])(?=.*[a]\z)/s (Lookaheads) or
/^[a].*(?<=[a])\z)/s (One of the few times (?<=...) works.)
/^[a].*[a]\z/s would not do, since it wouldn't match "a".
In reply to Re^2: Regex Semantics
by ikegami
in thread Regex Semantics
by cbro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |