I'm using a regular expression to search and replace template comments in html files, below is the snippet of code responsible :
Code: Select all
$string = preg_replace("#<!--%(.*?:)(\d+)%-->#", "$1", $string);Code: Select all
<!--%name:8%-->Code: Select all
<!--%name%-->What I want to do is use the second match parameter (\d+) to limit the number of charaters name is rpelaced with.
For instance :
Code: Select all
<!--%Description:5%-->Code: Select all
<!--%Descr%-->Any help would be appreciated.
Musaffar