Reputation: 9218
How would one remove all text between /* and */ (including these characters) in a string in JavaScript? Thanks!
Upvotes: 0
Views: 188
Reputation: 45589
/\/\*.*?\*\//g
your_str = your_str.replace(/\/\*.*?\*\//g, '');
Match the character "/" literally
Match the character "*" literally
Match any single character that is not a line break character
Between zero and unlimited times, as few times as possible, expanding as needed (lazy)
Match the character "*" literally
Match the character "/" literally
Upvotes: 5