[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Oniguruma question

Jonas Galvez

8/6/2007 9:30:00 PM

I've just installed oniguruma (gem install) and tried this:

reg = Oniguruma::ORegexp.new("\p{Lu}", {
:encoding => Oniguruma::ENCODING_UTF8
})

Shouldn't it match "A"? reg.match("A") returns nil.

--Jonas Galvez

1 Answer

Stefan Rusterholz

8/7/2007 1:49:00 AM

0

Jonas Galvez wrote:
> I've just installed oniguruma (gem install) and tried this:
>
> reg = Oniguruma::ORegexp.new("\p{Lu}", {
> :encoding => Oniguruma::ENCODING_UTF8
> })
>
> Shouldn't it match "A"? reg.match("A") returns nil.

Unfortunately Oniguruma fails to compile here so I can't test, but I
think your problem is your string.
"\p" == "p". If you want a literal \p, you need to do either "\\p" or
'\p'.

Regards
Stefan
--
Posted via http://www.ruby-....