[Gambas-user] Regular expressions

Markus Schatten markus.schatten at ...2005...
Fri Oct 31 23:36:58 CET 2008


On Friday 31 October 2008 22:40:03 Rob wrote:
> function FindAll(subj as string, pattern as string) as String[]
>         dim re as Regexp
>         dim matches as new String[]
>         re = new Regexp(subj, pattern)
>         do while re.offset >= 0 and subj <> ""
>                 matches.push(re.text)
>                 if len(subj) > len(re.text) then
>                         subj = mid(subj, re.offset + len(re.text) + 1)
>                 else
>                         subj = ""       
>                 end if
>                 if subj <> "" then re.exec(subj)
>         loop
>         return matches
> end

Thanks a lot Rob, this was exactly what I was looking for!

Best regards
-- 
Markus Schatten, MSc
Faculty of Organization and Informatics
Varaždin, Croatia
http://www.foi.hr


More information about the User mailing list