Page 1 of 1

Why is my regex not working

Posted: Sat Aug 27, 2016 4:40 pm
by gautamz07
Just have a random dumb question, why is that my below regex is not working ?

var item = "&item";
item.replace('/(&\w+)/g' , 'yolo');

I still don't see the contents of item being replaced with 'yolo'.

Re: Why is my regex not working

Posted: Sat Aug 27, 2016 4:44 pm
by gautamz07
got it '/(&\w+)/g' should be /(&\w+)/g