Skip to content

TheHolyOneZ/Regex-Pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 

Repository files navigation

For one line "//" comments

^\s*//.*$

For inline "//" comments

(?<!:)//.*

For one line <!-- --> comments

^\s*<!--.*$

For inline <!-- --> comments

<!--(?!.*\|).*?-->

for One line "/* */" comments

^\s*/\*.*?\*/\s*$

or

^\s*/\*.*\*/\s*$

for inline "/* */" comments

/\*.*?\*/

Enhanced & Additional Regex Patterns

For multi-line block comments (JS/C/Java)

/\*[\s\S]*?\*/

For all single-line and block comments (JS/TS, one pass)

(//.*$)|(/\*[\s\S]*?\*/)

For TODO or FIXME comments (anywhere)

//.*\b(TODO|FIXME)\b.*

For Python one-line comments

^\s*#.*$

For Python inline comments

(?<!['\"])#.*

For HTML multi-line comments

<!--([\s\S]*?)-->

For removing empty lines (cleanup)

^\s*$

For trailing whitespace (cleanup)

[ \t]+$

Tips:

  • Always test regex on a copy of your code!
  • For multi-line patterns, enable the "dotall" or "s" flag if your tool supports it.
  • Some patterns may need tweaking for your editor or language.

About

Regex Patterns for: html,css,js,xml blah blah blah

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published