Skip to content

Instantly share code, notes, and snippets.

@iammerrick
Created January 8, 2011 21:06
Show Gist options
  • Save iammerrick/771152 to your computer and use it in GitHub Desktop.
Save iammerrick/771152 to your computer and use it in GitHub Desktop.
<?php
//^.*(?=:) selects name
$subject = 'name:varchar(255)';
preg_match('/(?P<type>\w+)($|\((?P<length>(\d+|(.*)))\))/', $subject, $matches);
print_r($matches);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment