Hope the question was understandable. What I want to do is to match anything that constitutes a number (int and float) in python syntax. For instance, I want to match everything on the form (including the dot):
123
123.321
123.
My attempted solution was
"\b\d+/.?\d*\b"
...but this fails. The idea is to match any sequence that starts with one or more digit (\d+), followed by an optional dot (/.?), followed by an arbitrary number of digits (\d*), with word boundaries around. This would match all three number forms specified above.
The word boundary is important because I do not want to match the numbers in
foo123
123foo
and want to match the numbers in
a=123.
foo_method(123., 789.1, 10)
However the problem is that the last word boundary is recognised right before the optional dot. This prevents the regex to match 123. and 123.321, but instead matches 123 and 312.
How can I possibly do this with word boundaries out of the question? Possible to make program perceive the dot as word character?