Question A regular expression to get decimal and integers?

Scottintexas

Well-known member
Joined
Jun 21, 2018
Messages
47
Location
Texas
Programming Experience
5-10
I have this expression that works well.
C#:
(?<=\=)(\s?\#?[+|-]\d*.\d*)

But I also want it to catch "#0001". I can't get the syntax to ignore the decimal and the digits after it so it will return an integer value.

Thanks
 
#?[-+]?\d+(\.\d+)?

#? optional leading '#'.
[-+]? optional sign prefix
\d+ one or more numbers
(\.\d+)? optional period followed by one or more numbers

See Regex Storm .NET
 
Back
Top Bottom