Hi,

  In mail "Strscan ruby 1.8 why this doesn't work ?"
    domingo / dad-it.com (Domingo Alvarez Duarte) wrote:

> I have been using strscan till version 0.65 and it was working with a
> code like this but now trying to upgrade to ruby 1.8 it doesn't, is
> there a bug in strscan or I misunderstood it ?

Did you use Ruby version of StringScanner?  Try

  $ ruby -rstrscan -e 'p StringScanner'

with 0.6.5.  If it prints "StringScanner_R", it is Ruby version.
otherwise ("StringScanner_C") it is C version.

Ruby version and C version is completely *different*,
and C version is bundled with ruby 1.8.


> I expect to find a match for the regular expression but it doesn't.
> 
> 
> #---- code start here 
> require 'strscan'
> 
> SSI_search_re = /<!--#(.+?)#-->|\[\)(.+?)\(\]/m
> 
>     def parse(html)
> 	ret_var = ''
> 	ssc = StringScanner.new(html)
> 	ret_var << "\n0print(' xxx start scanner zzz ')\n"
> 	while ssc.scan(SSI_search_re) do

        while ssc.scan_until(SSI_search_re) do

might help.


Regards,
Minero Aoki