Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function trk_fastregex( $pagedata = '' )
- {
- $pattern = '/([\w\s.]*)({{(prj)\|([^|{}.]*)}})([\w\s.]*)/';
- $replace = '{{$1}}<a href="./?({{$3}})={{$4}}">{{$4}}</a>{{$5}}';
- $subject = $pagedata;
- $matches = array();
- for( ; preg_match_all( $pattern, $pagedata, $matches ) ; )
- {
- foreach( $matches as $key => $value )
- {
- $subject =
- str_replace(
- '{{' . '$' . strval( $key + 1 ) . '}}',
- $value,
- $subject
- );
- }
- $matches = array();
- }
- $pagedata = $subject;
- return $pagedata;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement