[ale] Regular Expression.

Michael B. Trausch mike at trausch.us
Tue Sep 4 13:43:52 EDT 2007


David Tomaschik, on 09/04/2007 01:21 PM said:
>
> Try something like:
> 
> 's/$_GET\[\('[A-Za-z0-9_-]*'\)\]/get_get(\1)/g'
> 
> David
> 

A-ha.  The following worked:

mbt at sage:~/public_html/sasap$ sed -i \
"s/\$_GET\[\(\$\?['\"A-Za-z0-9_-]*\)\]/get_get(\1)/g;" *.php
mbt at sage:~/public_html/sasap$ sed -i \
"s/\$_POST\[\(\$\?['\"A-Za-z0-9_-]*\)\]/get_post(\1)/g;" *.php
mbt at sage:~/public_html/sasap$ sed -i \
"s/\$_COOKIE\[\(\$\?['\"A-Za-z0-9_-]*\)\]/get_cookie(\1)/g;" *.php
mbt at sage:~/public_html/sasap$ sed -i \
"s/\$_REQUEST\[\(\$\?['\"A-Za-z0-9_-]*\)\]/get_request(\1)/g;" *.php

I don't know why I didn't think of that, other than the fact that my
regex-fu is kinda stinky.

Thanks for the response; it saved me from making ~500 edits by hand.

	-- Mike

-- 
Michael B. Trausch               Internet Mail & Jabber: mike at trausch.us
Phone:  (404) 592-5746 x1                         http://www.trausch.us/
Mobile: (678) 522-7934             VoIP: 6453 at sip.trausch.us, 861384 at fwd
Pidgin 2.1.1 and plugins for Ubuntu Feisty! http://www.trausch.us/pidgin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature




More information about the Ale mailing list