\d+\.?\d*|\.\d+(?=\s*ch)
applied to "sta.23.5 .1 words 67.89 ch"
captures 23.5 first because it matches \d+\.?\d*
The Or "|" has the highest precedence, if you want to think of it like that, splitting the pattern into two possible matches: \d+\.?\d*
and \.\d+(?=\s*ch)
If you want to prevent \d+\.?d*
from matching 23.5, you would have to add an extra criteria, like requiring a space character before it and using capturing parenthesis to get the number as a submatch: \s(\d+\.?\d*)
You could match both with this pattern, \s(\d+\.?\d*)|\.\d+(?=\s*ch)
, but keep in mind that if the first half matches you would be looking at the submatches for the actual value.
The real problem here is that VBScript's RegExp class doesn't support lookbehind, just lookahead.