Why is my regex not working

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

Why is my regex not working

Post 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'.
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

Re: Why is my regex not working

Post by gautamz07 »

got it '/(&\w+)/g' should be /(&\w+)/g
Post Reply