Skip to content

Instantly share code, notes, and snippets.

@jonasraoni
Created June 1, 2020 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonasraoni/36006a4666fcf1e33ace06dffce2e9d5 to your computer and use it in GitHub Desktop.
Save jonasraoni/36006a4666fcf1e33ace06dffce2e9d5 to your computer and use it in GitHub Desktop.
RegExp techniques to split
//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