Why is it that the following evaluates as True
?
Dim result = "b" Like "*a*b"
Thanks.
EDIT:
To generalize this a bit, the following returns True
:
"String1" Like "*AnyText1*AnyText2*AnyText???******????*String1"
VBA works correctly, returning False
.
PowerShell works correctly, returning False
:
PS C:\Users\XXX> "b" -Like "*a*b"
False
EDIT2:
The link to the bug report:
https://connect.microsoft.com/VisualStudio/feedback/details/748415/a-bug-in-net-like-operator
I decided, for fun, to open up ilspy to debug this :-)
in this method;
for this condition
by changing it to
it seem to be make it work as intended
I only did a few small test, nothing big
the issue is; it is only looking at the LAST asterisk and when it was valid, was stopping right there
my small change make sure to check the previous one, or anything in fact before it
with my fix
but does return true when it need to return true