Welcome Guest, Not a member yet? Register   Sign In
Formatting blog titles for easy url viewing
#1

[eluser]Bramme[/eluser]
Hey all

I'm trying to format blog titles into strings that can be used in the url. I know I have to use preg_replace, but I've never used regular expressions really and what I'm trying to do is throwing errors.

I first want to strip all non essential characters like '.,?!' etc... and then replace spaces with a dash (-).

So far I have this:
Code:
preg_replace('{[ \t]+}', '-', preg_replace('.|?|!', '', $row['title']))
(I got the {[ \t]+} from the php documentation), but I'm stuck on the points and so. I think that's where the eror occurs: function.preg-replace: No ending delimiter '.' found


Nevermind, found out that the url helper has a function for this.
#2

[eluser]Bramme[/eluser]
reduced the size because the problem was solved and no longer important... I always do that when I don't have the option of deleting my topics...




Theme © iAndrew 2016 - Forum software by © MyBB