Page 1 of 1

Hb_Regex() Y HB_RegexComp()

PostPosted: Wed Apr 05, 2017 5:32 pm
by Vikthor.Thomas
Hola Buen día

Alguien ha usado esa funciones para validar las expresiones.

Trabajo con FWH64 , BCC71 y Harbour para BCC71 y en las pruebas que hago el arreglo devuelto siempre esta vacío.

Code: Select all  Expand view


cRule := Hb_RegExComp("([A-Z]{6})")
, aRes := Hb_Regex( cRule , "VICTOR" )
 


El arreglo devuelto está vacío

Saludos

Re: Hb_Regex() Y HB_RegexComp()

PostPosted: Wed Apr 05, 2017 8:04 pm
by karinha
Code: Select all  Expand view

   LOCAL cRegEx := "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"

      cDest := "kapiabafwh@gmail.com"

      cDest := LOWER( cDest )

      cRet := HB_AtX( cRegEx, cDest, .F. )
 


Code: Select all  Expand view

FUNCTION verificaEmail(cEmail)

    LOCAL pCompiled := hb_regexComp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$")
    LOCAL aMatch
    LOCAL cRet := ""
    LOCAL lRet := .T.

    aMatch = hb_regex( pCompiled, cEmail )

    IF Empty( aMatch )

       cRet = "No"
       lRet := .F.

    ENDIF

RETURN( lRet )
 


Code: Select all  Expand view

METHOD StripHTML( cHtml ) CLASS Sintegra

   LOCAL cString := ::RemoveChar( cHTML, {"&","amp;","nbsp;",'<!-- ',' -->','<--','-->','||','\/','<!--%','%-->',[/\],'end if %'} )
   LOCAL aMatch  := HB_RegExAll( "\<[^\>]*\>", cString )

   AEVAL( aMatch, {|a| cString := STRTRAN( cString, a[1] ) } )

RETURN cString
 

Re: Hb_Regex() Y HB_RegexComp()

PostPosted: Mon Apr 10, 2017 2:10 pm
by Vikthor.Thomas
Gracias por responder

Yo sigo sin conseguir resultados satisfactorios

Qué versión de Fivewin y compilador estás usando ?

Saludos

Re: Hb_Regex() Y HB_RegexComp()

PostPosted: Mon Apr 10, 2017 3:14 pm
by karinha
FWH17.01 xHarbour para BCC72 y BCC72. Saludos. Muestra el que intentas hacer Victor.

Re: Hb_Regex() Y HB_RegexComp()

PostPosted: Mon Apr 10, 2017 8:58 pm
by Vikthor.Thomas
En la versión FWH64.1612 más Harbour 64 Bits para BCC71 que estoy usando la función hb_regex() siempre devuelve un arreglo vacío.

El mismo ejemplo usando FWH64.1311 más xHarbour para Visual Studio el valor devuelto por la función hb_regex() es correcto.

Alguna sugerencia ?

Saludos

Re: Hb_Regex() Y HB_RegexComp()

PostPosted: Tue Apr 11, 2017 5:28 pm
by karinha