php - Split code by semicolon -
i parse source code. read line line, 1 line can contain more 1 command.
i wonder if possible split line semicolons, those, aren't in '...'
or "..."
blocks.
answering question: split line semi-colon not inside double or single quoation marks, can use following regex:
(?:'[^']*'|"[^"]*")(*skip)(*fail)|;
it find ;
outside "..."
, '...'
.
see demo.
however, please consider using appropriate tools task taking up.
Comments
Post a Comment