2
我想使用空格拆分字符串,但不考慮雙引號或單引號。java - 正則表達式使用空格拆分字符串,但不考慮雙引號或單引號
我試過使用Regex for splitting a string using space when not surrounded by single or double quotes,但在某些情況下失敗了。
Input : It is a "beautiful day"'but i' cannot "see it"
和輸出應該是
It
is
a
"beautiful day"'but i'
cannot
"see it"
在上面的鏈接的正則表達式導致
It
is
a
"beautiful day"
'but i'
cannot
"see it"
我想在一個行"beautiful day"'but i'
。
有人能幫我寫出正確的正則表達式嗎?
當我修改,以**這是一個\ 「美麗day'but我」 \」 不能串\ 「看到它」**它失敗了。請你解釋它是如何工作的? –
請告訴我這個新的字符串「成功」的樣子。 – Bohemian
所需的輸出就像**「美麗的一天」,但我**。但我得到**「」美麗的一天「,但我**和**」我「不能連續行**」 –