Remove all non-numeric values

To remove all non-numeric values (everything that is not a number) from a string with RegEx you can use the following pattern. "12.99 €".replace(/[^\d+ »

JavaScript match with RegEx

The JavaScript match() function can be really useful when trying to match certain parts of a string. For example, if one were to use window.getComputedStyle( »

Global Flag

'This is my sentence'.replace(/ /g, '_'); // => "This_is_my_sentence" This will simply replace all spaces (/ /g) with an underscore. Notice the g »