Created
July 22, 2022 12:42
-
-
Save palpich/78ca9a353c27a0a7050fb1364ebed037 to your computer and use it in GitHub Desktop.
Find all spaces in str and replace to new line symbol
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
let str = 'foo bar baz' | |
str = str.replaceAll(/(\b +\b)/gm, '\n') | |
// foo | |
// bar | |
// baz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment