I've got like 6 pages were i get both POST and GET data several times (PHP). I've now made a function that get's the data for me, so instead of typing:
$_POST['whatever'];
i now type:
gpost('whatever');
The problem i have is that i'm to lazy to replace each $_POST with gpost() (and $_GET with gget(). I know how to do that. But i need to remove the [] braces aswell. Otherwise it'd look like this: gpost(['whatever']), not really what i want.
But looking at the find/replace window in dreamweaver i saw a checkbox labeled "Use regular expressions". Therefore I ask; can someone help me create a regular expression that replaces this:
$_POST['whatever'];
with this:
gpost('whatever');
The replace window looks like this:
EDIT: I now found a site, but it doesn't seem to work. Here's what i came up with now: trentmueller.com/blog/search-and-replace-wildcard-characters-in-dreamweaver.html
Find:
$_GET['([^<]*)']
Replace:
gget("$1")
I get this error: unmatched ) in regular expression
s/\$_POST\['(.*?)']/gpost('$1')/
should work, I believe. The $1 references the first match (The (.*?)), so if dreamweaver uses a different syntax for that you'd need to figure out what that is.\$_POST\['(.*?)']
is the "search" (Though the [ needs to be escaped with a \, that doesn't seem to want to appear in the comments, though), and thegpost('$1')
is the "replace"