> It then occurred to me that the code won't run if the regexp has no capture groups!
Why do you use the if if you don't want to test if there was no @match? (empty list-assignments are false)
and if you need the if b/c you wanna handle a no-match separately, why don't you use an else branch?
OK, I think your problem is that $re can match -hence be true - without any internal syntax defining (capture) groups.
Hence check if (@match) separately, whether with surrounding if for the $re or not depends on the desired logic...
after some testing do I like tybalt's solution the most Re: How to know that a regexp matched, and get its capture groups?
Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery
In reply to Re: How to know that a regexp matched, and get its capture groups?
by LanX
in thread How to know that a regexp matched, and get its capture groups?
by Anonymous Monk
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |