The first argument in replaceAll is a regex pattern and ^ is a special character in regex. You should escape it.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Steve Dyke
Ranch Hand
Joined: Nov 16, 2004
Posts: 1261
posted
0
Guido Granobles wrote:What are you trying to do?. Split the line ?
No. When the record is created the user inputs the data into a textarea field. This allows them to use carriage returns and line feeds. Before the data is stored in the database, since the characters used to do the carriage return and line feed is difficult to store I replace these with the '^' character. Now when the data is pulled to be displayed I need to put the carriage returns and line feeds back in where ever a '^' occurs.
Steve Dyke
Ranch Hand
Joined: Nov 16, 2004
Posts: 1261
posted
0
Lester Burnham wrote:"^" is a special character when it comes to regular expressions (which is what replaceAll does) - it needs to be escaped: try "\\^" instead.
Thanks again. Works great.
Guido Granobles
Greenhorn
Joined: Sep 11, 2010
Posts: 21
posted
0
That make sense. Althought there is a blank space between ^ and SCRATCHED. So you will have like a TAB in the next line.