Javascript Regex

  • . means "any character".
  • * means "any number of this".
  • ^ says at the beginning of the string.
  • $ says at the end of the string.
.*$ //Zero or more of any character (except line break) followed by end of string
"big bang".replace(/(\w+)\s(\w+)/, '$2 $1');

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store