Last active
August 29, 2015 14:21
-
-
Save craigsdennis/7bc7c2d61a7bc04a0c12 to your computer and use it in GitHub Desktop.
Regular Expressions example in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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