Advertisement
Guest User

Untitled

a guest
Dec 8th, 2014
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. <?php
  2. mb_internal_encoding("utf-8");
  3. header('Content-Type: text/html; charset=utf-8');
  4.  
  5. $text = htmlspecialchars($_GET['text']);
  6. $word = htmlspecialchars($_GET['word']);
  7.  
  8.  
  9. $pattern = "/[^\.\?\!\s][^\.\?\!]*\s".$word."\s[^\.\?\!]*[\.\?\!]/";
  10. preg_match_all($pattern, $text, $matches);
  11. foreach ($matches[0] as $key => $value) {
  12. echo "$value <br/>";
  13. }
  14.  
  15. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement