Regular Expressions 101

Community Patterns

Sustitution of comments (one line) //

0

Regular Expression
ECMAScript (JavaScript)

/
(^|\s*)(!?\/\/)[^\n]+\s*
/
g

Description

Sustitution of comments (one line) // Example ~ input (before) ↓↓ : // comment textplain other-text

// Other comment

Example ~ sustition (after) ↓↓: textplain other-text

Submitted by hzvvictor: https://github.com/hzvvictor - 9 months ago (Last modified 9 months ago)