Skip to content

Instantly share code, notes, and snippets.

@kounelios13
Last active March 29, 2016 08:32
Show Gist options
  • Save kounelios13/c84648fb94b607a5a182 to your computer and use it in GitHub Desktop.
Save kounelios13/c84648fb94b607a5a182 to your computer and use it in GitHub Desktop.
Get a string from the user and extract the numbers from the string
var str=prompt("Give me a string containing numbers");
var numbers=null;
if(str != null)
numbers=str.match(/[+-]?\d+(\.\d+)?/g);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment