On 30 Oct 2005, at 15:35, Gustavo Narea wrote:

I think that trim($matches[0]) will return the whole string with no change.

No, it will return the entire matching pattern, not just the sub- matches. I added the trim to remove any leading space, and there will nearly always be a trailing space because of the part of my pattern that defines a word will include it. It was simpler to use trim than to make the pattern skip it. Did you actually try it?

On the other hand, I think we have to place a caret after the first slash.

Only if you insist that your string must start with a word - putting a ^ at the start would make it omit the first word if there was a space in front if it.

Instead of preg_match(), I had to type preg_replace():

err. I think you missed the point here. You don't need all that messy substr stuff at all. The preg_match already did it.

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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

Reply via email to