From: John Victor Date: 2008-11-30T02:37:09+09:00 Subject: Re: Removing ^M character from text Thanks for the String#inspect, that really helps. I am trying to do a regexp match on the first line only of this text, I used the output from text.inspect: "CPU utilization for five seconds: 4%/1%; one minute: 2%; five minutes: 2%\r\n" "PID QTy PC Runtime (ms) Invoked uSecs Stacks TTY Process\r\n" "1 Cwe 40E8BAAC 80 1574 50 5560/6000 0 Chunk Manager \r\n" "2 Csp 41AD34D0 107060 19504749 5 2600/3000 0 Load Meter \r\n" "3 Mwe 41E1244C 8 8260 0 5136/6000 0 MPLS MIB traps \r\n" "4 Mwe 403D9860 1580 812729 1 5544/6000 0 DHCPD Timer \r\n" "5 Lst 40E9F268 211247688 17501448 12070 5616/6000 0 Check heaps \r\n" I thought it would be as simple as: /^CPU\sutilization.*\r\n/ but this returns all the text I have shown above. Why is it that my regexp doesn't stop at the "\n"? thanks vic Tim Hunter wrote: > On Linux, OS X, and other *ix systems, you can use cat -v. In Ruby, > String#inspect will show special characters escaped, so you can just use -- Posted via http://www.ruby-forum.com/.