cancel
Showing results for 
Search instead for 
Did you mean: 

Regular expression: Split String

Former Member
0 Kudos

Hi everybody,

I got to split a string when <b>'</b> occurs. But the string should <u>not</u> be splitted, when a <b>?</b> is leading the <b>'</b>. Means: Not split when <b>?'</b>

How has the regular expression to look like?

This does NOT work:

String constHOCHKOMMA = "[^?']'";

<u>Sample-String:</u>

String edi = "UNA'UNB'UNH?'xyz";

Result should be

UNA

UNB

UNH?'xyz

Thanks regards

Mario

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

Can you please explain what is that, and how it works

Regards

Abhijith YS

Former Member
0 Kudos

Thanks,

I got the answer in another forum:

String constHOCHKOMMA = "(?<!
?)'";

Regards Mario

Former Member
0 Kudos

Hi

I think u can meke it in two ways

1. using split function u r giving single quote as your delimiter, after each split funcction just add one more split function with delimiter as ?, if it returns true add the previous splited string and next one

2. you are gooing through each and every char of your string and split when next single quote occur, for this u are comparing each of your char with ['] i believe,

just compare the char with '?' if it match ignore next single quote.

Regards

Abhijith YS