
Function like InStr using wildcards?
Grinder-Thanks for your time.
I am searching text files which contain approx 1200 random characters:
Ex.)
AGHTLCYRETOLOPNQB.....etc.(with no spaces between characters)
for patterns such as "LCYR" or "L?YR" or "L[PCRY]YR" where each of these
would return the position 5.
It helps when I use InStr initially to search for some beggining letters
however some of the search strings I need to find must begin with
wildcards. Here is an example of my latest attempt at a faster
search(But it is still too slow):
Ex.) To search in MyText for RecogText where MyText=AGHTLCYRETOLOPNQB
and RecogText=TL?YR and StartLen=2 and RecogLen=5, see the following:
Call SearchFunc(RecogText$,StartLen%,RecogLen%)
'get search string, the number of beggining characters and it's length
Do While MyFind% < Len(MyText$)
MyFind% = InStr(MyFind% + 1, MyText$, Mid(RecogText$, 1,
StartLen%))
If MyFind% = 0 Then
MyFind% = Len(MyText$)
MyFind% = 0
Exit Do
End If
If MyFind% > 0 Then
If Mid(MyText$, MyFind%, RecogLen%) Like
RecogText$ Then
Print #1, MyFind%
End If
End If
Loop
MyFind% will return 3.
Thanks again for your time and help,
Lewis