• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regular expressions

 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,

I need to escape of single quote "'" and backslash "\".
is the following doing this?




later i need to return to the original string, do i need to do this:


 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a) looks like if you're trying to escape double quotes, not backslash.
b) to replace a backslash by an 'x', use:

The regexpressions use backslash as escape-character, so you have to give two of them.
But javac uses an backslash as escape-character too, so you have to preceede every backslash with another one, which leads to 4 backslashes in total.
Fortunately bb-code doesn't use backslashes itself - else I had to use 8 to make you see 4.

If you use a variable, you may print it out, if things get more complex:

[ May 12, 2005: Message edited by: Stefan Wagner ]
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic