Created
August 21, 2014 10:08
-
-
Save neilkennedy/2878b53d5ae0525bffdb to your computer and use it in GitHub Desktop.
Some JavaScript regex's to keep handy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.replace(/\s{2,}/g, ' ')//remove all double spaces with a single | |
.replace(/[ \t\r]/g, ''),//remove all whitespace | |
.trim()//remove leading and trailing spaces (supported IE9+) | |
"POINT (-0.159689 51.463423)".match(/(-?\d+(\.\d+)?)/g);//return the latitude & longitude from this WKT string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment