- May
- 24
- 0
Let's see if the string "-a" looks like an option, that is, whether it begins with a hyphen:
How odd. Maybe it must match the full string, even though that would make @regexindex[] meaningless:
Even weirder. Let me try that in in a Python script … works. Perl … works. gawk … works. Hmm. Let's try TCC again, but instead of the Ruby flavour we'll try TCC's perl, grep, gnu, and Python flavours … Nope. OK, back to Ruby flavour, just for consistency.
Well, something works, at least. Regrettably (and expectedly), however, I wanted an anchored search, and this now also matches:
Let's give this one last try:
Nope. At least the starting anchors dislike me.
What am I doing wrong, please?
Thanks,
Felix.
Code:
echo %@regex["^-","-a"]
0
Code:
echo %@regex["^-.*$","-a"]
0
Code:
echo %@regex["-","-a"]
1
Code:
echo %@regex["-","x-a"]
1
Code:
echo %@regex["\A-","-a"]
0
What am I doing wrong, please?
Thanks,
Felix.