Created
February 3, 2012 10:03
-
-
Save radmiraal/1729464 to your computer and use it in GitHub Desktop.
Regexp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class test { | |
protected $methodRegex = <<<EOF | |
/^ | |
\s* | |
(?P<visibility>public|protected|private)? | |
\s* | |
function | |
\s* | |
(?P<methodName>\w*) | |
\s*\( | |
/ | |
EOF; | |
public function getMethodRegex() { | |
return preg_replace("/(\n|\t|\r)/", NULL, $this->methodRegex); | |
} | |
} |
public $methodRegex = <<<EOF
/^
\s*
(
((?P<visibility>public|protected|private)\s*)
|
((?P<static>static)\s*)
){0,2}
\s*
function
\s*
(?P<methodName>\w*)
\s*\(
/
EOF;
public $methodRegex = <<<EOF
/^
\s* # Some possible whitespace
(
((?P<visibility>public|protected|private)\s*) # Visibility declaration
|
((?P<static>static)\s*) # Static declaration
){0,2} # Visiblity and Static can both occur, in any order
\s* # Some possible whitespace
function # Literal string 'function'
\s* # Some possible whitespace
(?P<methodName>\w*) # The method name
\s*\( # Some possible whitespace followed by a (
/x
EOF;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
EOF;