Skip to content

Instantly share code, notes, and snippets.

@ahinkle
Created January 9, 2025 22:41
Show Gist options
  • Save ahinkle/30c9f9a89ae3c68e7e6275f6992b71a9 to your computer and use it in GitHub Desktop.
Save ahinkle/30c9f9a89ae3c68e7e6275f6992b71a9 to your computer and use it in GitHub Desktop.
Regex: Identify PHP Comments

All // comments.

// some superfluous documentation.

^[\s]*\/\/.*$


Multiline:

// Multiline big dog
// which should have a good reason
// of why you would need it.

(^[\s]*\/\/.*\n){2,}


Passive Inline:

‘some-value’, // identify this please.

\/\/\s*[$\w\->()'\[\]"]+\s*$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment