php正则表达式匹配mysql数据类型,使用所有mysql数据类型作为主题,即
int(5)
varchar(10)
enum('yes', 'no')
我需要这样的数组:
array( 'int', 5 )
array( 'varchar', 10 )
array( 'enum', 'yes', 'no' ) or array ('enum', array('yes', 'no'))
到目前为止,我可以将括号的内容与:
/\(([^)]+)\)$/ and with /\((.*)?\)/
都说我需要:
number 1 - everything before the first opening parentheses
number 2 - everything inside the parentheses pair but not matching the parenthesis
number 3 - match the contents of the enum data type and return it's individual values (when values are delimited by "'" or by '"' or not delimited at all)
谢谢