FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour My regex fails under Harbour
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
My regex fails under Harbour
Posted: Fri Nov 04, 2022 10:21 AM
Any idea why I get .f. for all of these under Harbour?
Code (fw): Select all Collapse
#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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: My regex fails under Harbour
Posted: Fri Nov 04, 2022 12:32 PM
hua wrote:Any idea why I get .f. for all of these under Harbour?
Code (fw): Select all Collapse
#include "fivewin.ch"
proc main()
? hb_isregex("\d")
? hb_isregex("\d+")
? hb_isregex("[0-9]")
return
Please, try
Code (fw): Select all Collapse
#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
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: My regex fails under Harbour
Posted: Mon Nov 07, 2022 02:12 AM

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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: My regex fails under Harbour
Posted: Mon Nov 07, 2022 11:48 AM
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
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: My regex fails under Harbour
Posted: Tue Nov 08, 2022 03:14 AM
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
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: My regex fails under Harbour
Posted: Wed Nov 09, 2022 02:22 AM
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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: My regex fails under Harbour
Posted: Wed Nov 09, 2022 08:47 AM
thanks for sharing it :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion