string - using parenthesis replaceAll method Java -


i change word in sentence, word has parenthesis. keep in string variable. inside of variable st have

manages(p0,mt0)

inside of other string variable des have following sentence:

query(mt0, p0) :- not(manages(p0,mt0)), ins_manages(p0,mt0), not(physician(p0)), not(ins_physician(p0))

so have string variable querypart stores new word:

managesa

what tried in code was:

edc = edc.replaceall(st,querypart); 

but did not work.

i thought problem might paranthesis, changed string st variable like:

manages\\(p0,mt0\\)

then tried

edc = edc.replaceall(st,querypart); 

but had result. problem when use replaceall that:

edc = edc.replaceall("manages\\(p0,mt0\\)",querypart); 

the sentence changes

query(mt0, p0) :- not(managesa), ins_manages(p0,mt0), not(physician(p0)), not(ins_physician(p0))

i guess because of parenthesis not find solution that? solution?

i believe wanted use string#replace() (not replaceall), this

string edc = "query(mt0, p0) :- not(manages(p0,mt0)), "     + "ins_manages(p0,mt0), not(physician(p0)), not(ins_physician(p0))"; string querypart = "managesa"; edc = edc.replace("manages(p0,mt0)", querypart); system.out.println(edc); 

output is

query(mt0, p0) :- not(managesa), ins_managesa, not(physician(p0)), not(ins_physician(p0)) 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -