Created
October 24, 2017 08:02
-
-
Save iuliaL/cdbbbb2c92e056fbaf58948d5c1dd1c2 to your computer and use it in GitHub Desktop.
REGEX: Using Replace with Captured Groups
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 string = "Joaquin Smith"; | |
string.replace(/^(\w+) (\w+)$/, '$2 $1') | |
=> "Smith Joaquin" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment