FindAll and the correct pattern was the answer

Post your Gambas programming questions here.
Post Reply
sergioabreu
Posts: 95
Joined: Tuesday 9th July 2024 9:27am

FindAll and the correct pattern was the answer

Post by sergioabreu »

The only needed pattern to match latin characters is

Code: Select all

[\xc2\xc3][\x80-\xbf]
With no "()" neither "+" neither "?" :lol:

The work I wanted to be done is made by findall FUNCTION. findAll is static so you don't need to create a new instance.

Here is a complete view:

Code: Select all

Dim res as String[]
Dim s, source, patt as String

source =  "1aâ £oç õ § é Á Êüç x"  'Contains 10 latin chars mixed with ascii
patt = "[\xc2\xc3][\x80-\xbf]" 

res = RegExp.findAll( source,  patt )

For i = 0 To res.Count - 1
   Print i;; res[i];; Len(res[i]);; String.Len(res[i])
Next
Post Reply