Deye Posted August 5, 2019 Posted August 5, 2019 (edited) Hi, Got part of the code once upon a time ago from Melba This example is to illustrate If StringInStr($sString, $sfilter) Then .. the problem is when there will be no wild cards (it will always match when it shouldn't) so i just need to add to the pattern case sensitivity with "^" & "$" to both ends so that the pattern will work in all cases, yet to figure it out !? Thanks @Revised question _Match("SomeWord") _Match("Otherword*") _Match("*MoreWord*") Func _Match($sString, $sfilter = "word") $sPattern = StringReplace(StringRegExpReplace($sString, "[][$^.{}()+\-]", "\\$0"), "*", ".*?") $sPattern = StringReplace($sPattern, $sString, $sfilter) ConsoleWrite($sPattern & @LF) If StringRegExp($sString, "^" & $sPattern) Then MsgBox(0, "Match", $sPattern) EndIf EndFunc ;==>_Match Edited August 5, 2019 by Deye
Deye Posted August 5, 2019 Author Posted August 5, 2019 (edited) Sorry, had problems with the question's final edit Done now Edit: Got it working for what i needed And Just Updated what I had posted Here So the code in that post will work with WildCard Searching .. hanks Edited August 5, 2019 by Deye
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now