Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
O.P. RE: [PHP] Help with regular expressions
Thanks -dt-, but I have some other problems I think...
code: $smileys_from = array("<:o)", ":)", ":-)", ":D", ":d", ":>", ";)", ";-)", ":o", ":O", ":-O", ":P", ":p", ":-p", ":-P", "(h)", "(H)", ":@", ":-@", ":$", ":-$", ":s", ":S", ":-S", ":-s", ":-(", ":(", ":<", ":'(", ":|", ":-|", "(6)", "(A)", "(a)", "(L)", "(l)", "(U)", "(u)", "(m)", "(M)", "(@)", "(&)", "(S)", "(*)", "(~)", "(8)", "(E)", "(e)", "(F)", "(f)", "(w)", "(W)", "(O)", "(o)", "(K)", "(k)", "(G)", "(g)", "(^)", "(p)", "(P)", "(i)", "(I)", "(C)", "(c)", "(t)", "(T)", "({)", "(})", "(B)", "(b)", "(D)", "(d)", "(Z)", "(z)", "(x)", "(X)", "(y)", "(Y)", "(n)", "(N)", ":[", ":-[", "(?)", "(%)", "(#)", "(R)", "(r)", ":-#", "8o|", "8-|", "^o)", ":-*", "+o(", "(sn)", "(tu)", "(pl)", "(||)", "(pi)", "(so)", "(au)", "(ap)", "(um)", "(ip)", "(co)", "(mp)", "(brb)", "(st)", "(yn)", "(h5)", "(mo)", "(bah)", ":^)", "*-)", "(li)", "8-)", "(ci)", "(xx)", "(nah)", "|-)");
function stripplus($string) {
$search = array("[b]","[/b]","[u]","[/u]","[s]","[/s]","·#","·@","·'","·0");
$string = str_replace($search, "", $string);
foreach($smileys_from as $value) {
$cur = "·!" . $value;
$string = str_replace($cur, "", $string);
}
$string = preg_replace("/\[c=(\d{1,2})\]/", "", $string);
$string = preg_replace("/\[\/c.*?\]/", "",$string);
$string = preg_replace("/·\$[0-9]{1,2}/", "", $string);
return $string;
}
$psm = stripplus("Test ·$4one·0 ·$2two·0 ·$8three·0... ·#bold·# ·@underlined·@ ·!:P ·!:)");
This is my function, and my smiley array. This function, however, only succeeds to execute the first 2 lines. All the other lines fail...
Any idea?
This post was edited on 06-24-2006 at 03:11 PM by Matti.
|
|