> -----Original Message----- > From: Paul Halliday [mailto:paul.halli...@gmail.com] > Sent: 28 June 2012 02:27
> Using preg_match and this pattern I can get the refs: > > $pattern = '\reference:url,([^;]+;)\'; > > which gives me: > > $matches[0] = www.ndmp.org/download/sdk_v4/draft-skardal-ndmp4- > 04.txt > $matches[1] = doc.emergingthreats.net/bin/view/Main/2002068 > > now what I would like to do is replace inline adding "<a > href=http://" > . $matches[n] . ">" . $matches[n] . "</a>" > > Can this be done or do I need to say loop through matches (there can > be none or many) and do a str_replace. $new_string = preg_replace($pattern, '<a href="http://$1">$1</a>' , $string); should do it -- don't *think* you need any pesky \ escapes in the replacement, but could be wrong on that one, so please suck it and see... Cheers! Mike -- Mike Ford, Electronic Information Developer, Libraries and Learning Innovation, Portland PD507, City Campus, Leeds Metropolitan University, Portland Way, LEEDS, LS1 3HE, United Kingdom E: m.f...@leedsmet.ac.uk T: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php