Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

regex 1

Status
Not open for further replies.

SON1

Programmer
Nov 21, 2004
51
CY
i want to replace a word with \' (including the slash)

unfortunately i am not able to do it with this

temp = temp.replaceAll("word","\\'");

anyone knows how to ?
 
I think you miss a slash.

Code:
temp = temp.replaceAll("word","\\\'");

You need one to escape the slash itself and another one to slash the whatever ' is called in English.

Single quotation mark, perhaps?

Cheers,
Dian






 
nope...that didn't work either :(
 
Right, two more slashes.

Code:
temp = temp.replaceAll("word","\\\\\'");

I'll never understand the slashes thingie.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top