Hey, sorry, couldn't remember what the modifier for ungreedy matching was and couldn't be bothered to look it up :o so I just put the G in the modifier is supposed to be U, you need this otherwise you'll have some very odd results if you have more than one occurence of the pattern on any one line of the string. Also, you need a * ofter the character class. So it should look like this
$message = preg_replace('/index.php\/(.*)\/(.*)\/(.*)\/[^"' ]*/U', 'index.php?action=\\1&id=\\2&parid=\\3', $HTML);
Also, in retrospect, it might be wise to be little more specific than just .* on the three parts because there are certain characters which should not be accepted in that, take this as an example.
<a href="index.php/one" title="dog/cat">Domestic Pets</a>
would be transformed to
<a href="index.php?action=one" title="dog&id=cat">Domestic Pets<&parid=a>
Not what you're wanting I'd imagine.