My regex fails under Harbour

Post Reply
hua
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

My regex fails under Harbour

Post 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
 
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
User avatar
cnavarro
Posts: 6552
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: My regex fails under Harbour

Post 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()
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
hua
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: My regex fails under Harbour

Post 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
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
User avatar
cnavarro
Posts: 6552
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: My regex fails under Harbour

Post by cnavarro »

Dear Hua
Please look description this functions
https://www.kresin.ru/en/hrbfaq_3.html#Doc9
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
hua
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: My regex fails under Harbour

Post 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.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: My regex fails under Harbour

Post 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
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
User avatar
Antonio Linares
Site Admin
Posts: 42273
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: My regex fails under Harbour

Post by Antonio Linares »

thanks for sharing it :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply