$re = '/`([a-z]\w)*`.+auto_increment[\s\S]+/i';
$str = '`id` INT (11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT \'primary\',
`stu_name` VARCHAR (10) NOT NULL DEFAULT \'\' COMMENT \'username\',
`stu_class` VARCHAR (10) NOT NULL DEFAULT \'\' COMMENT \'class\',
`stu_num` INT (11) NOT NULL DEFAULT \'0\' COMMENT \'study number\',
`stu_score` SMALLINT UNSIGNED NOT NULL DEFAULT \'0\' COMMENT \'total\',
`tuition` DECIMAL (5, 2) NOT NULL DEFAULT \'0\' COMMENT \'fee\',
`phone_number` VARCHAR (20) NOT NULL DEFAULT \'0\' COMMENT \'mobile\',
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT \'record created time\',
`update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT \'record updated time\',
`status` TINYINT NOT NULL DEFAULT \'1\' COMMENT \'some comment\',';
$subst = "\1";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php