Michael, try defining your problem in words like this… I’m looking for a number that occurs AFTER a character that is NOT a whitespace, and BEFORE a whitespace. From there, you can refer to a regex cheatsheet (https://www.rexegg.com/regex-quickstart.html) or even use InDesign’s built-in cheatsheet (the little dropdown menu to the right of the GREP search field) to convert your sentence into regex.
What you’re looking for occurs ‘after’ something. This indicates a positive lookbehind—in other words, something must occur BEFORE we start matching any text. A positive lookbehind looks like this: (?<=…)
One way to represent ‘a character that is NOT a whitespace’ is by \S. So the positive lookbehind now looks like this: (?<=\S)
‘a number’ is, as Mr Jongware pointed out, simply a string of digits: \d+
What we’re looking for occurs ‘BEFORE’ something. This indicates a positive lookahead—in other words, something must occur AFTER our match. A positive lookahead, as Jongware pointed out, looks like this: (?=…). A whitespace is represented by , so our positive lookahead becomes (?=).
Put it all together, and we have:
(?<=\S)\d+(?=)
When you test this, you might find a problem. It matches the ‘234’ in ‘1234’. That’s because the digit ‘1’ also satisfies the criteria ‘NOT a whitespace’. So how would you fix this? You could change your sentence to ‘NOT a whitespace or a digit’. ‘OR’ logic can start getting confusing, but regex has a really nice way of matching a set of possible characters. You just put all the options in square brackets. For example, [abc] will match a, b, OR c. [\d] will match a whitespace OR a digit. But we want to match everything that is NOT one of these characters. We can do that by inserting ^ after the opening bracket like this: [^\d]. Here, the ^ means ‘NOT’.
So now our improved regex looks like this:
(?<=[^\d])\d+(?=)
We could have done the same thing with a NEGATIVE lookbehind. The ! in a negative lookbehind also means ‘NOT’:
(?<![\d])\d+(?=)
If you’re an absolute beginner with regex, I wrote a very basic tutorial which you might find useful: https://inkwire.app/articles/getting-started-with-regular-expressions.html
There are some links at the bottom of that page for more useful resources.