Using regsub to delete \r -- how? 
Author Message
 Using regsub to delete \r -- how?

Sorry for the dumb newbie question, but I can't seem to find a
regular expression to pass to regsub, to tell it to delete carriage
returns. I've tried \x0D and \r decorated in various ways with braces,
quotes, and backslashes, and also {*filter*}, but no luck.  Probably it's
easy, and I'm making it complicated. Help!


Michael Carroll
Research Libraries Group

Tue, 11 Nov 1997 03:00:00 GMT  
 Using regsub to delete \r -- how?

Its indeed easy,
regsub -all "\r" $str {} str ;
while remove all \r from str
(regsub -all \r $str {} str ; will too, the one that won't is
regsub -all {\r}...)

That's because there is no \ substitution (almost) withing regexp, and
thus you must do them inside tcl parsing (ie within "" or words)

<A HREF="">Laurent Demailly</A>

Tue, 11 Nov 1997 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. using string. vs regex/regsub: an example

2. using string vs regex/regsub: an example

3. using string. vs regex/regsub: an example

4. ANNOUNCE: molwgt.tcl - A molecular weight calculator (using regsub)

5. regsub: using an array as the subSpec

6. Using Regsub to substitute '-'

7. Delete lines using AWK.

8. deleting records in a file using AWK, SED, or kshell

9. deleting records using AWK, SED, etc.

10. deleting files using a pattern

11. DELETE using ABC?

12. Delete Using ODBC


Powered by phpBB® Forum Software