Recent Posts
None | 11 sec ago
Python | 26 sec ago
Lua | 39 sec ago
None | 42 sec ago
None | 58 sec ago
None | 1 min ago
None | 1 min ago
C++ | 2 min ago
None | 2 min ago
None | 2 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Anonymous on the 10th of Feb 2010 12:24:30 AM Download | Raw | Embed | Report
  1. function clean_post($post) {
  2.         $regex['c']  = '/([\s\w]{2,})/is';
  3.         $regex['l'] = '/(\w)\1{2,}/is';
  4.         $regex['i']  = '/\[(b|i|u|s|hr|sub|sup|img|media|snapback|spoiler|extract|anchor|twitter)\](.*?)\[\/\1\]/ims';
  5.         $regex['n'] = '/\[(url|list|email|topic|post|acronym|blog|entry|member)(?:.*?)\](.*?)\[\/\1\]/ims';
  6.         $regex['t']  = '/.*?(?:\[(?P<tag>quote|php|code|html|sql|xml).*?\])(?:.*?)(?:\[\/(?P=tag)\]).*?/ims';  
  7.        
  8.         $post = preg_replace($regex['c'], '$1', $post);
  9.         $post = preg_replace($regex['l'], '$1', $post);
  10.         $post = preg_replace($regex['i'], '$2', $post);
  11.         $post = preg_replace($regex['n'], '$2', $post);
  12.         while    (preg_match($regex['t'], $post, $matches)) {
  13.                 $post = str_replace($matches[0], '', $post);
  14.         }
  15.                
  16.         $points = 0;
  17.         $length = strlen($post);
  18.        
  19.         if ($length >= 80 && $length <= 199) {
  20.                 $points = 1;
  21.         } elseif ($length >= 200 && $length <= 399) {
  22.                 $points = 2;
  23.         } elseif ($length >= 400) {
  24.                 $points = 3;
  25.         }
  26.         return array($points, $post);
  27. }
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: