Regular Expressions 101

Community Library

Community Library Entry

0

Regular ExpressionOpen Workspace

/
^\s*(public|protected|private){1}\s*\$([a-zA-Z0-9_]+)\s*;\s*$
/
mg

Description
Created·2015-05-18 09:31
Type·Substitution
Flavor·PCRE (Legacy)

I use this regex to quickly convert the class' variables into a string which is usable with the "function" array. I copy-paste the varialbe name and use this regex. Useful to convert all your variable and put it in the magic function __sleep(). After it, you can delete the variables you don't want.

Submitted by Anonymous
Open Workspace