Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         //Im trying to get this regex to match my data-attributes. The Regex does seperate the words into words with a | but my //matching code isnt working.
  2. //Any ideas?
  3. var string = "car, boat, Anotherrandomword';
  4.     var regApproved=    new RegExp(`\\b(${string.split(',').join('|')})\\b`, 'gi')
  5.                 // console.log(regApproved);
  6.  
  7.                 rtnData = (
  8.            
  9.                 $(this).attr("data-payment").match(regApproved)
  10.                 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement