Skip to content

Instantly share code, notes, and snippets.

@joestump
Created August 29, 2009 18:49
Show Gist options
  • Save joestump/177617 to your computer and use it in GitHub Desktop.
Save joestump/177617 to your computer and use it in GitHub Desktop.
<?php
$strings = array(
'adsfa sdf adf asdf asdf adfasdfa sdf asdf',
'i like to buy ^abc, ^aa, ^aaaa, ^d.',
'^^Here is my twitter comment.',
'Here is my tweet. ^^I like turtles.'
);
foreach ($strings as $str) {
echo $str . "\n";
var_dump(preg_match('/\^\^/', $str));
$m = array();
var_dump(preg_match_all('/\^(?P<cities>[a-z]{2,})/i', $str, $m));
print_r($m);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment