Forum Moderators: coopster

Message Too Old, No Replies

php str replace anything but <value here>

         

jman11

11:46 pm on Nov 9, 2009 (gmt 0)

10+ Year Member



hey i have a str replace function that looks for key and replaces with value. im looking for how to do:


$arr = array("\b{anything but 0 here, so it could be a-z,A-Z,1-9 but i dont remember how}" => "<b>");

basically i want to have the array key be \b+anything but 0

coopster

2:48 pm on Nov 14, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Use the perl compatible regular expression [php.net] engine. Put the zero in a character class and negate it.
\b[^0]+

jman11

4:59 pm on Nov 14, 2009 (gmt 0)

10+ Year Member



yeh lol i figured that out once i actually looked thanks tho :D