Le 25/04/2012 18:58, Daniel Quintero a écrit :
>     Hello, I have an error in this line of code when I use the \s constant
> in the pattern:
>
> re = New Regexp(sText, "<span\s([^>]*)>")
>
>     If I use "<span([^>]*)>" (Without the \s) I have no error.
>
>     The error occurs when I press the F5 function key to execute the program.
>
>     This is the error text:
>
>   This application has raised an unexpected
> error and must abort.
>
> [11] Unknown symbol 'Editor' in class 'FForm'.
> Project.CompileError.2072
>
>
> And this is the complete code:
>
>
> Public Sub Button1_Click()
>    Dim re As Regexp
>    Dim sText As String = TextArea1.Text
>    Dim matches As New String[]
>    Dim i As Integer
>
>    ' Error with de \s constant in the pattern
>    re = New Regexp(sText, "<span\s([^>]*)>")
>    Do While re.offset>= 0 And sText<>  ""
>      matches.push(re.text)
>      If Len(sText)>  Len(re.text) Then
>        sText = Mid(sText, re.offset + Len(re.text) + 1)
>      Else
>        sText = ""
>      End If
>      If sText<>  "" Then re.exec(sText)
>    Loop
>
>    For i = 0 To matches.Max
>      Print matches[i]
>    Next
>
> End
>
>      I have attached the project to more clarity.
>
>     Thanks.
>
> *_________________________*
> *Lic. Daniel Quintero Rojas*
> http://www.dquinter.com.mx
> http://futbol.dquinter.com.mx
> http://twitter.com/#!/dquinteror
>
> *¡Saludos desde México!________**
>
> *
>

This is a bug in the compiler and in your code.

Do you use the last revision? If not, just fix your regular expression 
by quoting the '\' with another '\' (because '\' is both the quoting 
character in Gambas string and in regular expressions!)

Regards,

-- 
Benoît Minisini

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to