String replace any number

Hello. I have been struggling with "string replacer" the last hour. I need to replace any space separated number (with several digits) within a string by nothing. The string is in this case a stoichiometric reaction equation. And I want to replace the stoichiometric factors. E.g. if we have

1.005 A1g + 2.4 B2h = 1.5 C3i + 0.003 D4j

I want to replace 1.005 by nothing, 2.4 by nothing and so on. Hence, the result would be

A1g + B2h = C3i + D4j

The number within the names should not be touched by find&replace

I have tried "[0-9] ", but this does not work out for the whole number, only the last digit. "[0-9]* ", does not seem to work, either.

Do you know what the correct expression or approach would be?

You can use the following: ((?:\d+\.)?\d+ )

Great! Thanks! That works fine.

Next step: I want to keep the numbers, but next character after the number is a whitespace which i would like to replace with " * ".

If I use the same expression as replacement text plus " \* ", thus   ((?:\d+\.)?\d+ )\*, following happens:

Orig: 1.456 substance

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

Desired: 1.456*substance


The Replacement text is not recognized as regular expression. How do I proceed now?


The solution is to work with Back-references:

Find: ((?:\d+\.)?\d+)\s

Replace: $1*