Page 1 of 1

small doubt in regular expression

Posted: Thu Mar 16, 2006 7:12 am
by dude81
Back after long time :D

str_replace(

Code: Select all

/\*\s$/,""
)


will trunc the last space right .. this is my first regex help me...

Posted: Thu Mar 16, 2006 7:16 am
by Skittlewidth
Why not just use trim(), ltrim() or rtrim()? :?

Posted: Thu Mar 16, 2006 7:26 am
by dude81
I know that, but Im learning regular expressions... this a tutorial work

Posted: Thu Mar 16, 2006 7:40 am
by Chris Corbyn
Well you've used the wrong function ;) str_replace() doesn't know regex.

You need preg_replace()