Answer the question
In order to leave comments, you need to log in
How to split a string in which the delimiter (separator) can be escaped, and this must be taken into account?
There is a line like:
данные 1 | данные 2 | данные 3.1 \| данные 3.2 \| данные 3.3 | данные 4
[
'данные 1',
'данные 2',
'данные 3.1 \| данные 3.2 \| данные 3.3',
'данные 4',
];
Answer the question
In order to leave comments, you need to log in
Do a pre- replace sequence \| with a tricky combination like {-del-} , and beat the result with the | character. And in the resulting array, replace {-del-} back with \.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question