From: Alexander McMillan Date: 2013-01-16T22:42:07+09:00 Subject: Re: Escaped backslashes in input strings - newbie question --_cd175162-435e-4ecb-b4df-1c9de44b92d1_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Firstly=2C gsub does not make the removal of characters permanent=2C try gs= ub! Secondly=2C if you control the other program why not from there put the inp= ut into your own designed string delimiters instead of single and double qu= otes doing away with the need to use escape backslashes within the string? =20 =20 > Date: Wed=2C 16 Jan 2013 21:58:13 +0900 > From: jrs.idx@ntlworld.com > Subject: Escaped backslashes in input strings - newbie question > To: ruby-talk@ruby-lang.org >=20 > I am trying to find a way of removing escaped characters in input=20 > strings from a file made by another program. That is to say=2C=20 > two-character sequences in which the first character is a backslash. >=20 > I would have thought in my naivete that gsub(/\\./=2C"") would do this=2C= =20 > but no. I am using Ruby 1.9 hence Oniguruma. >=20 > Firstly=2C are the strings input from a text file treated as single- or=20 > double-quoted? >=20 > Secondly=2C are there alternatives to gsub? >=20 > Thirdly=2C are there any *clear* and *exhaustive* treatments of the=20 > question of escaped backslashes in Ruby - in input strings in programs=2C= =20 > in IRB=2C with single-quoted strings=2C double-quoted strings and other=20 > situations? I guess a multidimensional table might be useful to=20 > determine how to escape a backslash=2C if it can be done at all. >=20 > Regards >=20 > John Sampson >=20 = --_cd175162-435e-4ecb-b4df-1c9de44b92d1_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Firstly=2C gsub does not make the removal of characters permanent=2C try gs= ub!
Secondly=2C if you control the other program why not from there put the inp= ut into your own designed string delimiters instead of single and double qu= otes =3Bdoing away with the need to use escape backslashes within the s= tring?
 =3B

 =3B
>=3B Date: Wed=2C 16 Jan 2013 21:58:1= 3 +0900
>=3B From: jrs.idx@ntlworld.com
>=3B Subject: Escaped bac= kslashes in input strings - newbie question
>=3B To: ruby-talk@ruby-la= ng.org
>=3B
>=3B I am trying to find a way of removing escaped c= haracters in input
>=3B strings from a file made by another program. = That is to say=2C
>=3B two-character sequences in which the first cha= racter is a backslash.
>=3B
>=3B I would have thought in my naiv= ete that gsub(/\\./=2C"") would do this=2C
>=3B but no. I am using Ru= by 1.9 hence Oniguruma.
>=3B
>=3B Firstly=2C are the strings inp= ut from a text file treated as single- or
>=3B double-quoted?
>= =3B
>=3B Secondly=2C are there alternatives to gsub?
>=3B
&g= t=3B Thirdly=2C are there any *clear* and *exhaustive* treatments of the >=3B question of escaped backslashes in Ruby - in input strings in prog= rams=2C
>=3B in IRB=2C with single-quoted strings=2C double-quoted st= rings and other
>=3B situations? I guess a multidimensional table mig= ht be useful to
>=3B determine how to escape a backslash=2C if it can= be done at all.
>=3B
>=3B Regards
>=3B
>=3B John Sam= pson
>=3B
= --_cd175162-435e-4ecb-b4df-1c9de44b92d1_--