For example, "Question!!!!!" will be changed to "Question!" and "Who can help?????" will be changed to "Who can help?"
but "I love you...my baby" will be changed to "I love you.my baby" and this is not good
I want change in 3 points, if there are more than 3
// Exclamation point in message
if (preg_match("/([!?.])+/", $message))
{
$message_array = preg_split("/n/", $message);
for ($x = 0; $x < count($message_array); $x++)
{
if (!preg_match("/[.*//", $message_array[$x])) // Ignore BBCode...
{
$message_array[$x] = preg_replace("/([.])+/", "...", $message_array[$x]);
}
$message = implode("n", $message_array);
}
for ($x = 0; $x < count($message_array); $x++)
{
if (!preg_match("/[.*//", $message_array[$x])) // Ignore BBCode...
{
$message_array[$x] = preg_replace("/([!])+/", "> $message_array[$x] = preg_replace("/([!])+/", "\1", $message_array[$x]); <", $message_array[$x]);
$message_array[$x] = preg_replace("/([?])+/", "> $message_array[$x] = preg_replace("/([?])+/", "\1", $message_array[$x]); <", $message_array[$x]);
}
$message = implode("n", $message_array);
}
}
if (preg_match("/([!?.])+/", $message))
{
$message_array = preg_split("/n/", $message);
for ($x = 0; $x < count($message_array); $x++)
{
if (!preg_match("/[.*//", $message_array[$x])) // Ignore BBCode...
{
$message_array[$x] = preg_replace("/([.])+/", "...", $message_array[$x]);
}
$message = implode("n", $message_array);
}
for ($x = 0; $x < count($message_array); $x++)
{
if (!preg_match("/[.*//", $message_array[$x])) // Ignore BBCode...
{
$message_array[$x] = preg_replace("/([!])+/", "> $message_array[$x] = preg_replace("/([!])+/", "\1", $message_array[$x]); <", $message_array[$x]);
$message_array[$x] = preg_replace("/([?])+/", "> $message_array[$x] = preg_replace("/([?])+/", "\1", $message_array[$x]); <", $message_array[$x]);
}
$message = implode("n", $message_array);
}
}
P.S. Tried to post in IP Costumizations, but only mod can