Welcome Guest, Not a member yet? Register   Sign In
Search files question
#2

From stackoverflow.

Consider using preg_replace_callback.

Use this regex: (images/([0-9]+)[^"]+")

Then, as the callback argument, use an anonymous function. Result:

You should be able to modify this to work for you.

PHP Code:
$output preg_replace_callback(
 
   "(images/([0-9]+)[^\"]+\")",
 
   function($m) {
 
       // $m[1] is the number.
 
       $t getTitleFromDatabase($m[1]); // do whatever you have to do to get the title
 
       return $m[0]." title=\"".$t."\"";
 
   },
 
   $input
); 

Give it a try.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
Search files question - by wolfgang1983 - 08-29-2017, 02:38 AM
RE: Search files question - by InsiteFX - 08-29-2017, 03:36 AM
RE: Search files question - by wolfgang1983 - 08-29-2017, 04:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB