2021年2月5日星期五

Regex split by space except strings inside single quotation

I have the following string

This is some testing dbo.GetPersonData(this_.PersonId,'Date contract recieved from the client') cs.dbo.Person 'this is test'

I want it generic and obtain the following result

This  is  some  testing  dbo.GetPersonData(This_.PersonId,  'DateContract received from the client'  )  cs.dbo.person  'this is test'  

What I am trying to achieve here is to split by spaces apart of anything between single quotation

I have tried using

'(.*?)'|\S+  

However, it is ignoring: <'Date contract recieved from the client'>

Result

https://stackoverflow.com/questions/66066381/regex-split-by-space-except-strings-inside-single-quotation February 05, 2021 at 11:52PM

没有评论:

发表评论