Standalone numbers Regex?

Using lookaround, you can restrict your capturing to only digits which are not surrounded by other digits or decimal points:

(?<![0-9.])(\d+)(?![0-9.])

Alternatively, if you want to only match stand-alone numbers (e.g. if you don't want to match the 123 in abc123def):

(?<!\S)\d+(?!\S)

try this

(?<!\S)\d+(?!\S)

this will only match integers


If I understand you right, you want to match those numbers with a point inside, too, but dont want to have these in the resulting collection.

I would approach this via 2 steps, first select all numbers, also those with a dot:

(\d+(?:\.\d+)*)

then filter out everything that is not purely numbers, and use your first regex and apply it to each item of the resulting collection from the first step:

(\d+)