Skip to content

Instantly share code, notes, and snippets.

@stchr
Last active August 29, 2015 14:10
Show Gist options
  • Save stchr/1260db16e64efeb19b96 to your computer and use it in GitHub Desktop.
Save stchr/1260db16e64efeb19b96 to your computer and use it in GitHub Desktop.
regex replace to give class method calls and new object instances a backslash for global namespace
class methods
search: (?<![\\A-Z])([A-Z]+::{1,1}[A-Z]+\()
replace: \\$1
class constants
search: (?<![\\A-Z])([A-Z]+::{1,1}[A-Z]+)
replace: \\$1
new instances
search: (new )(?<![\\A-Z])([A-Z]+\()
replace: new \\$2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment