Today I got into a situation where I need to extract the numbers from the string variable on client side using jQuery. If a string has 1 or more occurrence of the numbers then also need to extract it and store it into an array. For example, if the string is
var str = '3jquery33By333Example3333';
And required output is:
So all I need was a regular expression which matches all the numbers in the string and return the array. Below is the jQuery code which I have used.