Welcome Guest, Not a member yet? Register   Sign In
Searching a string for a character and all the characters till the next whitespace?
#2

[eluser]sophistry[/eluser]
happy birthday! here's a present for you...

preg_replace() is the function you need.

regex pattern for the preg_replace() function (assumes whitespace before pound sign #):
Code:
'/#([a-z0-9]+)\s/i'

replacement:
Code:
'<a href="http://example.com/tags/$1">$1</a>'

give that a try.

EDIT: added i switch to the regex pattern to make it case insensitive.


Messages In This Thread
Searching a string for a character and all the characters till the next whitespace? - by El Forum - 08-05-2009, 09:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB