vinay vinay - 1 year ago 348
Java Question

Dangling meta character '*' near index 6

When I'm replacing the character

with an empty string I get the following exception :
Dangling meta character '*' near index 6

Here is my code :

String siteDelimit=subjectStudy.getSubject().getSubjCdDelimiter();
//think siteDelimit having **
subject.setSubjectCode(subject.getSubjectCode().replaceAll(siteDelimit, ""));

Answer Source

replaceAll() takes a regex, therefore you get this error. If you don't want to use regex, you can use the method which don't take regexes, i.e. replace()

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download