I am trying to implement a search, where user enters the characters on the keyboard and I use the search String to lookup channels from a list matching.
The keyboard returns the entered string as roString.
If i pass this string to regExOb = CreateObject(“roRegex”, searchString, “i”) , and then call regExOb.IsMatch(channel.channelName) does not return true even if it does match.
If i hardcode the searchString, the isMatch() function seems to function properly.
I even tried regExOb = CreateObject(“roRegex”, searchString.toStr(), “i”), but did not work.
Please help me to understand why roRegex does not accepts roString or String as matching-pattern.
Based on what you described I tried an experiment;
searchstring = "whatever"
? " ------ type of searchstring is "; type(searchString)
regExOb = CreateObject("roRegex", searchString, "i")
channel = "I watch whatever I want"
? "regExOb is match ? "; regExOb.IsMatch(channel)
------ type of searchstring is String
regExOb is match ? true
mystring = "whatever"
list = CreateObject("roList")
list.Addtail(mystring)
searchstring = list.GetTail()
? " ------ type of searchstring is "; type(searchString)
regExOb = CreateObject("roRegex", searchString, "i")
channel = "I watch whatever I want"
? "regExOb is match ? "; regExOb.IsMatch(channel)
------ type of searchstring is roString
regExOb is match ? true
I know this doesn’t answer your question but maybe it explains that the problem is something different than what you thought? My understanding of the docs is that roString and regular old String should be interchangeable here.
Thanks. I had to go with the Instr() approach. Will try once again what could be the issue.
In my case the both strings to regex were of type roString.