Skip to content

Instantly share code, notes, and snippets.

@YasirGaji
Created February 22, 2022 17:47
Show Gist options
  • Save YasirGaji/82c6da0c6969c5793c6a699ab4711dff to your computer and use it in GitHub Desktop.
Save YasirGaji/82c6da0c6969c5793c6a699ab4711dff to your computer and use it in GitHub Desktop.
This script shows how to valuate a regular expression using the "replace()" function for the "Regular Expressions in Javascript" article by Yasir Gaji
// VALUATING THE REGULAR EXPRESSION USING THE "replace()" FUNCTION
const stillTheFirstWay = /words between slahses/; //declared regular expression
const anExpression = 'The words between slahses has been replaced thanks to the ".replace()" function'; //declared statement
const thereplacedExpression = anExpression.replace(stillTheFirstWay, 'statements'); //valuating
console.log(thereplacedExpression);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment