Created
December 28, 2018 11:03
-
-
Save melvinstanly/5e8ae50d129be7c5e2b204e340299565 to your computer and use it in GitHub Desktop.
Regular expression tricks
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
* To replace all runs of white spaces in a string with ( _ ) underscore => /\s+/g | |
-> Replace adjacent white spaces with a single underscore | |
* To replace whitespace in a string with underscore => / /g | |
-> Replace each white space with a single underscore. Each adjacent white spaces will be replaced |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment