[ale] Regular Expression.

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


For the life of me, I cannot figure out a regex that will do what I want
it to do.  I want to change every instance of the string:

	$_GET['varname']

to:

	get_get('varname')

Using something like sed to automagically do the work for me.  I tried
to do this, however, using the following regex:

	's/$_GET\[\('.*'\)\]/get_get(\1)/g;'

... which only works if there is one $_GET[''] on the line.  If there
are more than one, though, it does something like this:

if ((isset(get_get('id'])) && ($_GET['id') != ''))

Is there a way to make the \[\('.*'\)\] part of the regex less greedy so
that it will match EXACTLY one instance?  What follows may be any
character, including a newline.

	-- 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