Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RegExp question
Message
De
08/02/2017 14:03:40
 
 
À
08/02/2017 12:49:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01647702
Message ID:
01647712
Vues:
77
This is part of a tool I am developing. A test suite console for my FUnit tool.

>Please forgive me I am totally wrong, but it seems to me like you are tying to reinvent the wheel. Have you ever tried Gofish?
>
>>Have been trying to construct a Regular Expression pattern to find a string that only exists at the beginning of a line, even if there are none or more white spaces before it (either spaces or tabs).
>>
>>Example text I'm search
>>
>>
>>DEFINE CLASS test
>>	PROCEDURE init
>>		IF ATC("DEFINE CLASS",x)>0
>>		*
>>		ENDIF 
>>		IF ATC("PROCEDURE",x)>0
>>		*
>>		ENDIF 
>>	ENDPROC
>>	PROCEDURE destroy
>>	ENDPROC
>>ENDDEFINE 
>>
>>
>>If I am look for the "DEFINE CLASS" (ignoring the case), I would like for it to find only the "DEFINE CLASS test". Also, If I am looking for "PROCEDURE", I want it to find only the "PROCEDURE init" and "PROCEDURE destory", not the one in the ATC().
>>
>>Here is a example of the search code I am trying.
>>
>>
>>RegExp = NEWOBJECT( "_RegExp", "RegExp.vcx" )
>>ctext=FILETOSTR("tt.prg")
>>? RegExp.execute( ctext, [(\bdefine class\b)], .F., .T.)
>>? RegExp.execute( ctext, [(\bprocedure\b)], .F., .T.)
>>
>>
>>I realize I need to be including the '^' (start of line), possibly '\s*' for the white spaces. but when I do include them the query fails to find anything. I only want it to find matches that are at the beginning of the lines.
Greg Reichert
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform