Dim rc As Boolean = "2" Like "*?<*?"
I don't understand why rc equals True, surely 2 is not like *?<*? at all.
The above pattern requires a string with
<)< symbol is somewhere on the interior.As far as I can work out < is not a special character that means something other than < to the Like operator.
Using Visual Studio 2010.
While I can't directly explain why 2 is like "*?<*?".
Your query reads;
* - Match 0 or more characters? - Followed by one single character< - Followed by the < character* - Followed by 0 or more characters? - Terminated by one single characterFor your logic you want;
at least three characters before it matches, with "<" occurring somewhere on the interior of the string
Which results in a query of;
Dim rc As Boolean = "2" Like "???*<*"
Which reads;
??? - Match at least 3 characters* - Followed by any number of further characters< - Followed by the < character* - Followed by any number of further charactersNot a direct answer I know, but I hope it helps all the same...
EDIT:
To answer your comment below.
You would like to;
find a string which has a "<" in it somewhere with at least one character on either side
Which results in a query of;
Dim rc As Boolean = "2" Like "*?<?*"
This would return False as a result, as would;
Dim rc As Boolean = "<" Like "*?<?*"
However;
Dim rc As Boolean = "2<2" Like "*?<?*"
Would return true.
I hope this helps (more!)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With