Page 1 of 1
PatternFindStr, how work it?
Posted: Fri Feb 08, 2013 11:40 am
by Juan Carlos
This instruction PatternFindStr, func, state, val = PatternFindStr(s$, pat$) how work it? I want make a single program to find keywords in text and file names for example mad word in file names as madhouse, etc., how I can do the compare of a filename?
I hope write my question clear and simple. Thanks.
Re: PatternFindStr, how work it?
Posted: Sun Feb 10, 2013 10:55 pm
by airsoftsoftwair
If you just want to search for words, it's easier to use
FindStr().
Re: PatternFindStr, how work it?
Posted: Tue Feb 12, 2013 3:23 pm
by Juan Carlos
Andreas wrote:If you just want to search for words, it's easier to use FindStr().
Thanks for the idea, because I'm working with the PatterFindStr
Re: PatternFindStr, how work it?
Posted: Tue Feb 12, 2013 7:41 pm
by Juan Carlos
I tested the FindStr() in this code:
Code: Select all
TextoBuscado={}
ficheros$ = {}
directorios$ = {} ;En el array introducimos el nombre de las subcarpetas.
;Nota no muestra carpeta origien, sólo subcarpetas.
NumFicheros=ReadDirectory(Directorio$, ficheros$, directorios$)
TextoBuscar$ = "America"
For Busqueda=0 To NumFicheros Step 1
TextoBuscado=FindStr(ficheros$[Busqueda], TextoBuscar$[True])
Next
FicherosBusqueda=ListItems(TextoBuscado$)
Paso=10
For MuestraFicheros=0 To FicherosBusqueda Step 1
TextOut(200, Paso, TextoBuscado$[MuestraFicheros]) ;Poner entre el número de ficheros.
Paso=Paso+10
Next
Where I read the files inside of drawer and I want search one file that has the word America as name, but it doesn't show me the file/s with this name, where is the problem and I want show a list where I can clicking on the file with the name to example show it, also How is programm?
Re: PatternFindStr, how work it?
Posted: Mon Apr 13, 2015 11:22 am
by lazi
Stayin on topic
Is
PatternFindStr() is able to separate lines of text at \r or at \n characters?
I am a bit lost in the wood of the search patterns.
The full problem is, that I want the most elegant solution to load a text file to string then process it line by line.
Every help welcome!
Bye
Re: PatternFindStr, how work it?
Posted: Mon Apr 13, 2015 11:39 am
by lazi
Maybe I found it:
PatternFindStr(data$,"(%C+)")
%C+ means all non control characters.
But what are the control characters? Are the tab is a control character?
Re: PatternFindStr, how work it?
Posted: Mon Apr 13, 2015 10:07 pm
by airsoftsoftwair
Yes, TAB (\t) is a control character as are \r and \n.
PatternFindStr() shouldn't be affected by them.