This is a little suspicious: /(:?aaa)?/ ...because /(?:aaa)?/ would be non-capturing parentheses. What you have instead is a capturing parenthesis expression that begins with an optional colon. Is that what you meant?
As to your question, your entire expression is optional (i.e., /(aaa)?/), so it doesn't really require Perl to match anything. In my little fooling around, I didn't find a way to get it to find the optional string while still keeping it optional, but there probably is a way.
In reply to Re: Regex: succeeds, but parens don't collect...
by kyle
in thread Regex: succeeds, but parens don't collect...
by Wiggins
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |