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

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -