Skip to content

Instantly share code, notes, and snippets.

Created March 13, 2014 13:29
Show Gist options
  • Save anonymous/9528482 to your computer and use it in GitHub Desktop.
Save anonymous/9528482 to your computer and use it in GitHub Desktop.
regex
<?php
$str[] = ':jamie_h!~textual@72.32.115.231 PRIVMSG #test_channel :test message';
$str[] = ':jamie_h!~textual@72.32.115.231 PRIVMSG #test_channel :fii message';
$str[] = ':jamie_h!~textual@72.32.115.231 PRIVMSG #test_channel :foo message';
foreach($str as $s) {
preg_match('/:([^!]+)[^:]+:((test|fii).+)/', $s, $matches);
print_r( $matches );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment