daily pastebin goal
77%
SHARE
TWEET

Regex Config

a guest Feb 19th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const RegExpBracketOpen = new RegExp(/\[/g);
  2.  
  3. const RegExpBracketClose = new RegExp(/\]/g);
  4.  
  5. const RegExpKoma = new RegExp(/\,/g);
  6.  
  7. let config = `a = ["foo","bar","baz","qux"]`;
  8.  
  9. config = config.replace(RegExpBracketOpen, '[\n');
  10.  
  11. config = config.replace(RegExpBracketClose, '\n]');
  12.  
  13. config = config.replace(RegExpKoma, ',\n');
  14.  
  15. console.log(config);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top