Advertisement
elena1234

RegularExpression in JavaScript

Aug 9th, 2021 (edited)
1,286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(text) {
  2.     let result = text.toUpperCase()
  3.       .match(/\w+/g) // \w+ and g to match every word; / .... / is for regEx; i is for capital insensitive; /[^9]/ - match everything except 9
  4.       .join(', ');
  5.      
  6.     console.log(result);
  7. }
  8.  
  9. solve('Hi, how are you?')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement