[Gambas-user] Regular Expressions :: Error with gb.pcre component

Daniel Quintero dquinter at ...626...
Wed Apr 25 18:58:57 CEST 2012


   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!________**

*
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RegularExpressions.tar.gz
Type: application/x-gzip
Size: 5343 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20120425/6170bf31/attachment.bin>


More information about the User mailing list