Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
ECMAScript (JavaScript)

/
(\/\/.*| ?\/\*[^]*?\*\/)(,?)$
/
gm

Description

This has been validated against a tsconfig.json file that i'm using and nothing else. It should work fine though.

You can use this to replace comments with vscode find and replace, but using the regex in the search field, and '$2' without quotes in the replace field.

Submitted by anonymous - 4 years ago