Posted By

thefrosty on 10/21/10


Tagged

regex


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


RegEx match whole sentence.


 / Published in: Regular Expression
 

I\'m trying to find an expression to match a whole sentence. So really the pattern is the regex of the subject.

  1. $subject = "Check out the newest #WordPress premium theme marketplace";
  2.  
  3. $pattern = "/Check out the newest #WordPress premium theme marketplace http://themelit.com/$";
  4.  
  5. if ( preg_match_all( $pattern, $subject, $matches ) )
  6. $msg = array( "code" => "success", "message" => __("Thanks for tweeting!" ) );
  7. else
  8. $msg = array( "code" => "error", "message" => __("You haven't tweeted anything yet." ) );

Report this snippet  

You need to login to post a comment.