Why not...

$url = ereg_replace("See ([^ ]*) for", "See <a
href='urlgoeshere?key=\1'>\1</a> for", $original_string)

or something close to that.

On Fri, 13 Dec 2002, Gareth Hastings wrote:

> Hi,
>
> I'm trying to work out the regex needed to split either one of the
> following lines
>
> Windows 2000 Hotfix (Pre-SP4) See Q322842 for more information
> Windows XP Hotfix (SP2) See Q327696 for more information
>
> Into one of these
>
> Windows 2000 Hotfix (Pre-SP4) See <a
> href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322842'>Q
> 322842</a> for more information
> Windows XP Hotfix (SP2) See <a
> href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q327696>Q3
> 27696</a> for more information
>
> I can work out half of the expression but not the other half lol, I've
> used a combination of ereg and split but I'm sure this can be done with
> 1 ereg statement. Here is my code
>
> $ms = "http://support.microsoft.com/default.aspx?scid=kb;en-us;";;
>
>
> if (ereg("(\[See )([Q|q][0-9]+)( for more information\])", $name))
> {
>       $sp = split("\[See ", $name);
>       ereg("([Q|q][0-9]+)( for more information\])", $sp[1], $qb);
>
>       $url = $sp[0] . "See <a href='$ms" . $qb[1] . "'
> target='_blank'>" . $qb[1] . "</a> for more information";
>
> }
>
> Any ideas?
>
> Gareth
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to