When parsing an FTX string (free text), I need to break it using + as a delimiter, but only when it is not preceded by an escape character (say ? ). Thus, this line nika ?+ marry = love+sandra ?+ alex = love should be divided into two lines: nika + marry = love and sandra + alex = love . Using String.Split('+') clearly not enough. Can I somehow achieve this?
One way, it seems to me, is to replace the occurrences of ?+ With some unique character (or sequence of characters), say @#@ , splitting using "+" as a separator, and then replacing @#@ Return to + , but it is unreliable and wrong in any possible case that I can think of.
? it is used as an escape character only in combination with : or + , in any other case it is considered as a regular character.
nicks source share