I wrote it mainly for test purposes.
So, not wholly skipping CRLF is a bug of PCRE, not regex plugin.

-----------------------------------------------------------------------
RegEx(esc("0r0n",0)++"abcdef",".+", 1, 0, 0)

Function RegEx(sSubject,sPattern,bCRLF,bNoEmp,bUni)

local PCRE_NOTEMPTY = 0x400
local PCRE_UTF8     = 0x800
local PCRE_NEWLINE_CRLF = 0x300000

local ov=dll.create_array(20,"i")

local pOffsets=dll.get_pointer(ov)
local pSubject=dll.get_pointer("sSubject")
local nLen=length(sSubject)

local pError,nErrCode,nErrOff

local pCode=dll.call("Cdecl|pcre|pcre_compile2|s+ i i* i* i* ui";;+
,"sPattern",if(bUni,PCRE_UTF8),"nErrCode","pError","nErrOff",0)

win.debug("ErrorCode: "++nErrCode,"ErrorOffset: "++nErrOff)

/*
local sError
dll.call("Cdecl|wsprintf|s+ s- ui","sError","%s",pError)
win.debug(sError)
*/

local nOptions = if(bNoEmp,PCRE_NOTEMPTY) | if(bCRLF,PCRE_NEWLINE_CRLF)
local nStrOff = 0

for()
local nCount=dll.call("Cdecl|pcre|pcre_exec|ui ui ui i i i ui i";;+
,pCode,0,pSubject,nLen,nStrOff,nOptions,pOffsets,20)

win.debug(nCount++":",ov[1],ov[2])

if(nCount <= 0 || nStrOff == ov[2])
break

nStrOff=ov[2]
endfor
-----------------------------------------------------------------------

Sean

Reply via email to