Thread: clean urls baby
m0nkeymafia

first of all you guys rock, i actually freel [more] comfortable with

regex

  now after you guys helpin me
anyway i know this is lame but im well happy so should post anyway

in order to get clean urls, i.e. say a link to an article but without the crap you dont want like brackets and whatnot i used to do a str_replace on abunch of bad character, and i thought that was snazzy.

but it dawned on me that I could use a simple

regex

  to do it, simply by doing ereg_replace('(^[A-z]+)','',$var); will remove all non characters from $var, which is uber cool! btw im writing that

regex

  from memory it may be slightly off, but still, i thought id share the love

ta ta

perkiset

Congrats on the

Regex

  strength MM - it does rock.

And BTW you're right, the

regex

  _replace functions are really handy - may I ask why you went with ereg_replace rather than preg_replace? I thought from my reading that overall the preg_ functions were safer... thoughts?

m0nkeymafia

well my

regex

  skills are to the point where I can cobble something together, i dont really know the difference between the two
what is the difference? lol

perkiset

Well, the dox say the ereg are "Posix Extended" WTF that means... but all over the dox page it points to the preg functions which are

PERL

  compatible and seem to be more active in both discussion and capabilities. I've just always used them because the tone of the ereg funcs seemed either specialized or in some way less robust...

Looking for anyone with an opinion here... WebProfessor perhaps?

vsloathe

In another language I use, I pretty much always set the flag to return the results of a String

Regex

 () in

PHP

 /

Perl

  mode. FWIW

nutballs

posix extended means you can do this i think.
[[:digit:]]

not worth it. preg_XXXXXXX is faster from what I have read and in my quick simple testing.

m0nkeymafia

nice one balls


Perkiset's Place Home   Politics @ Perkiset's