[Tutor] Search and replace

Paul Hartley p.hartley@spitech.com
Tue Jan 14 20:16:02 2003


This is a multi-part message in MIME format.

------=_NextPart_000_0022_01C2BC78.C0D0C500
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I have some text that contains semicolons surounded by spaces, for =
example :-

123 ;345   ;   456; 55 ;    ;   ;123 abc

And I want to remove those spaces, but not other spaces, so the above =
line would be :-

123;345;456;55;;;123 abc

I know there must be a simple way using re - I have done this but used =
two while loops until all the spaces are gone, not very elegant.

Another question, the text is in another application, my current =
solution is to copy it to the clipboard, save in a file and then =
convert. Is there a better way?

Paul

------=_NextPart_000_0022_01C2BC78.C0D0C500
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I have some text that contains =
semicolons surounded=20
by spaces, for example :-</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>123 ;345&nbsp;&nbsp; ;&nbsp;&nbsp; 456; =
55=20
;&nbsp;&nbsp;&nbsp; ;&nbsp;&nbsp; ;123 abc</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>And I want to remove those spaces, but =
not other=20
spaces, so the above line would be :-</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>123;345;456;55;;;123 abc</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>I know there must be a simple way using re - I have done this but =
used two=20
while loops until all the spaces are gone, not very elegant.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Another question, the text is in another application, my current =
solution=20
is to copy it to the clipboard, save in a file and then convert. Is =
there a=20
better way?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Paul</DIV></FONT></DIV></BODY></HTML>

------=_NextPart_000_0022_01C2BC78.C0D0C500--