note 928 deleted from migration3 by didou

From: Date: Fri, 03 Oct 2003 11:56:45 +0000
Subject: note 928 deleted from migration3 by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-57728@lists.php.net to get a copy of this message
Note Submitter: dan.brice@outreach.net ---- I had to upgrade a large amount of php2 code and I ended up writing a perl script that did most of the job for me. If you are upgrading to php3 you may find this usefull. Here is a list of the regexps I used. It doesn't catch everything, but about 90% of my files worked without any more changes. Dan. <p> $text =~ s%([._])phtml%\1php3%msgx;<br> <p> # Change all string concats from + to . (Not in reg exprestions though!) (This isn't perfect)<br> $text =~ s%([^][0-9][^][0-9][^][0-9])[+]([^][)";0-9]*["])%\1.\2%msgx;<br> $text =~ s%(["][^][)";0-9]*)[+]([^][0-9][^][0-9][^][0-9])%\1.\2%msgx;<br> <p> # Change the functions to C-Style <br> $text =~ s%Function[ ]* <br> ([a-zA-Z0-9]*)<br> ([^(]*)<br> [(] <br> ((<br> (["](([^\\"]|[\\].))*["])<br> | <br> ([/][*] ([^*] | [*][^/] )* [*][/])<br> | <br> ([^()"/]|[/][^*])<br> ([(]<br> ([^()]*[(]<br> ([^()]*[(]<br> ([^()]*[(]<br> ([^()]*[(][^()]*[)])* <br> [^()]*[)]<br> )* <br> [^()]*[)]<br> )* <br> [^()]*[)]<br> )* <br> [^()]*[)] )* <br> )*)<br> [)][;]?<br> %function \1 (\2) \{ \3\} %msgx;<br> <p> #Change all <? > to <? ?> - watch for html, comments, if statements...<br> $text =~ s%[<][?](<br> ( ( ([^">()/] | [/][^*])* <br> ( ( ["](<br> ([^\\"]|[\\].) <br> )* ["] ) | <br> ( [/][*] ([^*] | [*][^/] )* [*][/] )<br> | ( [(]<br> ([^()]*[(]<br> ([^()]*[(]<br> ([^()]*[(]<br> ([^()]*[(]<br> ([^()]*[(][^()]*[)])* <br> [^()]*[)])* <br> [^()]*[)])* <br> [^()]*[)])* <br> [^()]*[)])* <br> [^()]*[)] ) )<br> )* ([^">()/] | [/][^*])*)<br> )[>]%<?\1 ?>%msgx;<br>

« previous php.notes (#57728) next »