Xojo regex vs regexrx

Dim rx As New RegEx
rx.SearchPattern = "(?mi-Us)Du (\d{4}) au (\d{4})|^(\d+);([\w|\s|-]+);|^-> (\d{4});|(\d+,\d{2})|(\[FIN\])"
Dim rxOptions As RegExOptions = rx.Options
'rxOptions.LineEndType = 4
Dim thefile As String = ReplaceLineEndings( tis.ReadAll( Encodings.UTF8), EndOfLine.UNIX)
Dim match As RegExMatch = rx.Search( thefile )
If match IsA RegExMatch Then
  

leads to the same match=nil
“tis” is the textinputstream
using xojo 2019r11

that’s what I was prepared for !

found it !
the original file did not always have the same encoding ! once it is utf8, other is macroman.
if you use tis.readall it sets the encoding and you have no means to read what it is.

I guess regexrx does this in the background, when you paste, or open the file…
nice work Kem !

I ended up the method with :

'Dim thefile As String = ReplaceLineEndings( tis.ReadAll( Encodings.UTF8), EndOfLine.UNIX)
Dim thefile As String = tis.ReadAll
Dim te As TextEncoding = thefile.GuessEncoding
thefile = DefineEncoding( thefile, te)
thefile = ConvertEncoding( thefile, Encodings.UTF8)
Dim match As RegExMatch = rx.Search( thefile )
1 Like