RegEx, convert from Classic ASP

I’ve tried to convert this (former) working code, but in Xojo there are too many errors… What parts are wrong!?

[code] DIM text, pattern as String
pattern = “<div[^\d]+ ((?:\d+| )+).+\(([\d,]+) sekunder\) "
text = “<div id=”“resultStats””>Ungefr 6 330 resultat (0,17 sekunder) "

DIM r = New RegEx
r.IgnoreCase = True
r.Global = True
r.SearchPattern = pattern
Set Matches = r.Execute(text)

textCode.text = text

For each Match in Matches
textCode.text = Match.SubMatches(0) + EndOfLine
textCode.text = Match.SubMatches(1)
Next[/code]

The languages are not the same.

  DIM text, pattern as String
  pattern = "<div[^\\d]+ ((?:\\d+|&#160;)+).+\\(([\\d,]+) sekunder\\)&nbsp;</nobr></div>"
  text = "<div id=""resultStats"">Ungefr 6&#160;330 resultat<nobr> (0,17 sekunder)&nbsp;</nobr></div>"
  
  DIM r AS New RegEx
  r.Options.CaseSensitive = False
  'r.Global = True // Don't know what this does
  r.SearchPattern  = pattern
  dim match as RegExMatch = r.Search( text )
  
  textCode.text = text + EndOfLine
  
  while match <> nil
    textCode.AppendText match.SubExpressionString( 0 ) + EndOfLine
    textCode.AppendText match.SubExpressionString( 1 ) + EndOfLine
    
    match = r.Search
  wend

Thank you for taking the time to write the answer!

The output of the above code is the content of “text” written twice… and it’s not the purpose…

Fellow colleagues!!
I asked yesterday for some advise in this issue. Let me be more clear.
I want the code to be as in this picture:

As in this moment, the code only give this result:

The purpose is, to fetch the total number of hits on a search in Google. Maybe this is not the good solution!?
If anyone can give me advice or a hint of where to look to solve this issue I would be very happy!

DIM text, pattern as String
  pattern = "<div[^\\d]+ ((?:\\d+|&#160;)+).+\\(([\\d,]+) sekunder"
  text = "<div id=""resultStats"">Ungefr 6&#160;330 resultat<nobr> (0,17 sekunder)&nbsp;</nobr></div>"
  
  DIM r AS New RegEx
  r.Options.CaseSensitive = False
  'r.Global = True // Don't know what this does
  r.SearchPattern  = pattern
  dim match as RegExMatch = r.Search( text )
  
  textCode.text = text + EndOfLine
  
  while match <> nil   
    textCode.AppendText match.SubExpressionString( 1 ) + EndOfLine
    textCode.AppendText match.SubExpressionString( 2 ) + EndOfLine
    
    match = r.Search
  wend

This code will find every such string within the text and return the parts in the SubExpressionStrings of the match. With your example text, it would return 6&#160;330 and 0,17. You can then use ReplaceAll to remove or replace &#160; in the first string.