RegEx match whole sentence.


/ Published in: Regular Expression
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.