Page 1 of 1
My regex fails under Harbour
Posted: Fri Nov 04, 2022 10:21 am
by hua
Any idea why I get .f. for all of these under Harbour?
Code: Select all | Expand
#include "fivewin.ch"
proc main()
? hb_isregex("\d")
? hb_isregex("\d+")
? hb_isregex("[0-9]")
return
Re: My regex fails under Harbour
Posted: Fri Nov 04, 2022 12:32 pm
by cnavarro
hua wrote:Any idea why I get .f. for all of these under Harbour?
Code: Select all | Expand
#include "fivewin.ch"
proc main()
? hb_isregex("\d")
? hb_isregex("\d+")
? hb_isregex("[0-9]")
return
Please, try
Code: Select all | Expand
#include "fivewin.ch"
proc main
local pRegx
pRegx := HB_RegExComp( "\d" )
? hb_isregex( pRegx )
//
return
HB_IsRegEx( <uExp> ) → <lIsCompRegEx>
Tells if <uExp> is a compiled regular expression compiled with HB_RegExComp()
Re: My regex fails under Harbour
Posted: Mon Nov 07, 2022 2:12 am
by hua
Thanks Cristobal.
The sentence now works in my standalone test but not my module.
Is there anyway to check where the linker is pulling hb_regex() from? It seems suspicious that I get an empty array when there is no match instead of NIL
Re: My regex fails under Harbour
Posted: Mon Nov 07, 2022 11:48 am
by cnavarro
Dear Hua
Please look description this functions
https://www.kresin.ru/en/hrbfaq_3.html#Doc9
Re: My regex fails under Harbour
Posted: Tue Nov 08, 2022 3:14 am
by hua
Thanks Cristobal.
If under Harbour hb_regex() returns an empty array when no match is found then it is different from xHarbour. From
xHarbour Language Reference Guide 1.1
Return
The function returns an array filled with the found substrings matching the regular expression. If no match is found, the return value is NIL.
Thanks for pointing that out.
Re: My regex fails under Harbour
Posted: Wed Nov 09, 2022 2:22 am
by hua
Just an update. The problematic regex problem went away when I rearranged libs (the bold part) to be linked from
j:\harbour\bcc7\lib\cw32.lib +
j:\harbour\bcc7\lib\import32.lib +
j:\harbour\bcc7\lib\uuid.lib +
j:\harbour\bcc7\lib\ws2_32.lib +
j:\harbour\hbcc7\lib\win\bcc\hbcpage.lib +
j:\harbour\hbcc7\lib\win\bcc\hbcplr.lib +
j:\harbour\hbbc7\lib\win\bcc\hbct.lib +
j:\harbour\hbbc7\lib\win\bcc\hbpcre.lib +
j:\harbour\hbbc7\lib\win\bcc\hbnf.lib +
j:\harbour\hbbc7\lib\win\bcc\xhb.lib +
j:\harbour\hbbc7\lib\win\bcc\hbziparc.lib +
j:\harbour\hbbc7\lib\win\bcc\hbmzip.lib +
j:\harbour\hbbc7\lib\win\bcc\hbzlib.lib +
j:\harbour\hbbc7\lib\win\bcc\minizip.lib +
j:\harbour\hbbc7\lib\win\bcc\hbusrrdd.lib +
j:\harbour\hbbc7\lib\win\bcc\hbtip.lib +
j:\harbour\hbbc7\lib\win\bcc\hbzebra.lib +
j:\harbour\bcc7\lib\psdk\odbc32.lib +
to
j:\harbour\hbcc7\lib\win\bcc\hbcpage.lib+
j:\harbour\hbcc7\lib\win\bcc\hbcplr.lib+
j:\harbour\hbbc7\lib\win\bcc\hbct.lib +
j:\harbour\hbbc7\lib\win\bcc\hbpcre.lib +
j:\harbour\hbbc7\lib\win\bcc\hbnf.lib +
j:\harbour\hbbc7\lib\win\bcc\xhb.lib +
j:\harbour\hbbc7\lib\win\bcc\hbziparc.lib +
j:\harbour\hbbc7\lib\win\bcc\hbmzip.lib +
j:\harbour\hbbc7\lib\win\bcc\hbzlib.lib +
j:\harbour\hbbc7\lib\win\bcc\minizip.lib +
j:\harbour\hbbc7\lib\win\bcc\hbusrrdd.lib +
j:\harbour\hbbc7\lib\win\bcc\hbtip.lib +
j:\harbour\hbbc7\lib\win\bcc\hbzebra.lib +
j:\harbour\bcc7\lib\cw32.lib +
j:\harbour\bcc7\lib\import32.lib +
j:\harbour\bcc7\lib\uuid.lib +
j:\harbour\bcc7\lib\ws2_32.lib +
j:\harbour\bcc7\lib\psdk\odbc32.lib +
Now I'm only left with the perplexing issue of the linker not finding hbcpage.lib and hbcplr.lib even though in the link script the full path was written and I checked to make sure they exist. For the time being I'm forced to copy both of the libs into where my source is
Re: My regex fails under Harbour
Posted: Wed Nov 09, 2022 8:47 am
by Antonio Linares
thanks for sharing it