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

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -