Skip to content

Instantly share code, notes, and snippets.

@craigsdennis
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigsdennis/7bc7c2d61a7bc04a0c12 to your computer and use it in GitHub Desktop.
Save craigsdennis/7bc7c2d61a7bc04a0c12 to your computer and use it in GitHub Desktop.
Regular Expressions example in PHP
$title = "Regular Expressions in 10 different languages";
$pattern = "~(\\d+)~";
$success = preg_match($pattern, $title, $match);
if ($success) {
echo "There are " . $match[1] . " languages represented.";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment