Having never really used Regex before and probably need to, I went to http://regexone.com/ to get the basics.
I did the basic tutorials and have moved onto the first practical example. I got this working but my solution differs from their answer. Can anyone explain why?
Below are a few different formats of numbers that you might encounter. Notice how you will have to match the decimal point itself and not an arbitrary character using the dot metacharacter. If you are having trouble skipping the last number, notice how that number ends the line compared to the rest.
Question
Grunt
Having never really used Regex before and probably need to, I went to http://regexone.com/ to get the basics.
I did the basic tutorials and have moved onto the first practical example. I got this working but my solution differs from their answer. Can anyone explain why?
Their solution: ^-?\d+(,\d+)*(\.\d+(e\d+)?)?$
Link to comment
Share on other sites
2 answers to this question
Recommended Posts