On Wed, 25 Jun 2003, D T wrote:

> For your example, I think the problem is on irb:

ah - yes it is - not the first time that has happened.  good catch!

i does seem to work then, and it's much simpler than mine!

-a

> try this on irb and you know what I mean.
> irb(main):001:0> '\\'.length
> 1  # see, it is 1 not 2, kind of in irb simple quote string still substitute \\
> irb(main):002:0>
>
> Dave
>
> ahoward <ahoward / fsl.noaa.gov> wrote:
> On Wed, 25 Jun 2003, D T wrote:
>
> > /"(?:[^\\"]+|\\.)+"/ # did you see the different? :-)
>
> /usr/home/howardat > irb
>
> irb(main):001:0> '"an escaped\" quote"' =~ /"((?:[^\\"]+|\\.)+)"/ && puts("(#{$1})")
> (an escaped\" quote)
> => nil
>
> irb(main):002:0> '"an escaped\\\" quote"' =~ /"((?:[^\\"]+|\\.)+)"/ && puts("(#{$1})")
> (an escaped\\)
> => nil
>
> this doesn't seem to work?
>
> -a
> --
> ====================================
> | Ara Howard
> | NOAA Forecast Systems Laboratory
> | Information and Technology Services
> | Data Systems Group
> | R/FST 325 Broadway
> | Boulder, CO 80305-3328
> | Email: ara.t.howard / noaa.gov
> | Phone: 303-497-7238
> | Fax: 303-497-7259
> | ~ > ruby -e 'p(%.\x2d\x29..intern)'
> ====================================
>
>
> ---------------------------------
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> --0-2003196418-1056484417=:12613
> Content-Type: text/html; charset=us-ascii
>
> <DIV>It works, if you try this</DIV>
> <DIV>test.rb&nbsp; # put it on a file and run by ruby not irb</DIV>
> <DIV>&nbsp;</DIV>
> <DIV>str = &lt;&lt;'EOF'<BR>"an escaped\" quote"<BR>"an escaped\\\" quote"<BR>EOF<BR>str.each_line{ |line|<BR>&nbsp; p line<BR>&nbsp; p line.scan(/"(?:[^\\"]+|\\.)+"/).collect! {|e| e.sub!(/^"(.*)"$/, '\1')}<BR>}</DIV>
> <DIV>&nbsp;</DIV>
> <DIV>For your example, I think the problem is on irb:</DIV>
> <DIV>try this on irb and you know what I mean.</DIV>
> <DIV>irb(main):001:0&gt; '\\'.length<BR>1&nbsp; # see, it is 1 not 2, kind of in irb simple quote string still substitute \\<BR>irb(main):002:0&gt;<BR></DIV>
> <DIV>Dave</DIV>
> <DIV><BR><B><I>ahoward &lt;ahoward / fsl.noaa.gov&gt;</I></B> wrote:</DIV>
> <BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">On Wed, 25 Jun 2003, D T wrote:<BR><BR>&gt; /"(?:[^\\"]+|\\.)+"/ # did you see the different? :-)<BR><BR>/usr/home/howardat &gt; irb<BR><BR>irb(main):001:0&gt; '"an escaped\" quote"' =~ /"((?:[^\\"]+|\\.)+)"/ &amp;&amp; puts("(#{$1})")<BR>(an escaped\" quote)<BR>=&gt; nil<BR><BR>irb(main):002:0&gt; '"an escaped\\\" quote"' =~ /"((?:[^\\"]+|\\.)+)"/ &amp;&amp; puts("(#{$1})")<BR>(an escaped\\)<BR>=&gt; nil<BR><BR>this doesn't seem to work?<BR><BR>-a<BR>--<BR>====================================<BR>| Ara Howard<BR>| NOAA Forecast Systems Laboratory<BR>| Information and Technology Services<BR>| Data Systems Group<BR>| R/FST 325 Broadway<BR>| Boulder, CO 80305-3328<BR>| Email: ara.t.howard / noaa.gov<BR>| Phone: 303-497-7238<BR>| Fax: 303-497-7259<BR>| ~ &gt; ruby -e 'p(%.\x2d\x29..intern)'<BR>====================================<BR></BLOCKQUOTE><p><hr SIZE=1>
> Do you Yahoo!?<br>
> SBC Yahoo! DSL - Now only $29.95 per month!
> --0-2003196418-1056484417=:12613--
>
>

-a
--
  ====================================
  | Ara Howard
  | NOAA Forecast Systems Laboratory
  | Information and Technology Services
  | Data Systems Group
  | R/FST 325 Broadway
  | Boulder, CO 80305-3328
  | Email: ara.t.howard / noaa.gov
  | Phone:  303-497-7238
  | Fax:    303-497-7259
  | ~ > ruby -e 'p(%.\x2d\x29..intern)'
  ====================================