Ensure regex does not pull from numbers in named materials

I have a regex string to grab all sorts of numbers, however I notice it also grabs numbers that are immediately following text.

For instance using a test sentence like:
The block of Nylon-12 was 1.23 by 4E-56 by -7.89
I would like to extract the 1.23, 4E-56 and -7.89. I also appears to be grabbing the -12 from the Nylon-12.

Fairly new to regex syntax, how should I start my expression to ensure it is not grabbing the number from a word. If there is a space between any text characters and number characters, that is fine but when there is no space like in Nylon-12, I do not want to be capturing them.

My regex expression I made to grab numbers is provided here:

[+\-]?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+\-]?(?:0|[1-9]\d*)(?:\.\d+)?)?

where using regexper looks like this:
regex visualized

EDIT:

This seems to be an issue relating to the +/- operator search. I tried to put a \b at the start and see the results.

If I throw in Nylon12, Nylon-13, or Nylon+14 into the regex, it returns -13 and +14, not the 12.

Read more here: Source link