Created
June 1, 2020 17:43
-
-
Save jonasraoni/36006a4666fcf1e33ace06dffce2e9d5 to your computer and use it in GitHub Desktop.
RegExp techniques to split
This file contains 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
//Split by nothing/position | |
'USDEUR'.split(/(?=\w{3}$)/); //["USD", "EUR"] | |
//Split without consuming/swallowing | |
'2020-10-10'.split(/(-)/); //["2020", "-", "10", "-", "10"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment