Regular Expressions 101

Community Patterns

Community Library Entry

-1

Regular Expression
PCRE (PHP <7.3)

/
((?<raute>#(?<raute_content>[^\n]*))|(?<doubleslashes>\/\/(?<doubleslashes_content>[^\n]*))|(?<block>\/\*(?<block_content>[^*]+|\*(?!\/))*+\*\/))
/
gm

Description

Find Comments starting with # or //. Also finds Commentblocks starting with /* and ending with */.

Submitted by Candyman1332 - 9 years ago