Hi Greg,
Looking at
modify class _regexp of Ffc\_regexp.vcx method execute, it misses the multiline option.
LParameters tcStr, tlCaseMatters
Local loRegEx, loMatch, loMatches, i
loRegEx = CreateObject("VBScript.RegExp")
loRegEx.pattern = this.pattern
loRegEx.ignoreCase = !tlCaseMatters
loRegEx.global = .T.
loMatches = loRegEx.execute(tcStr)
Dimension this.matches[Max(loMatches.count,1),2]
taMatchInfo = .F.
i = 1
For Each loMatch In loMatches
this.matches[i, 1] = loMatch.firstIndex + 1
this.matches[i, 2] = loMatch.value
i = i + 1
EndFor
loMatches = .F.
loRegEx = .F.
Return i -1
You need to instantiate "VBScript.RegExp" yourself:
loRegEx = CreateObject("VBScript.RegExp")
loRegEx.pattern = this.pattern
loRegEx.ignoreCase = !tlCaseMatters
loRegEx.global = .T.
loRegEx.multiline = .T.
Then this pattern should work:
(^[ \t]*(?=[_\u0041-\u005A\u005F\u0061-\u007A\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0152-\u0153\u0160-\u0161\u0178\u0192#@&=\?\.\\](?!&))(?:(?:HIDD(?:E|EN)?|PROT(?:E|EC|ECT|ECTE|ECTED)?)(?:[ \t]+|(?:[ \t]*;\s*?(?=
>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.
Thierry Nivelet
FoxinCloud
Give your VFP application a second life, web-based, in YOUR cloud
http://foxincloud.com/Never explain, never complain (Queen Elizabeth II)