cancel
Showing results for 
Search instead for 
Did you mean: 

Regular expression

Former Member
0 Kudos

Hi everybody,

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

How has the regular expression to look like?

This does NOT work:

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

Sample-String:

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

Result should be

<i>UNA

UNB

UNH?'xyz</i>

Thanks regards

Mario

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
String edi = "UNA'UNB'UNH?'xyz";
String splitted[] = edi.split("(?<!\?)'");

for (int i=0;i<splitted.length;i++) {
   System.out.println (splitted<i>);

}

regards Franz

reward points if useful

Former Member
0 Kudos

Hi Franz!

10-Pointer!!!!

Thanks, Regards Mario

Answers (0)