Florian Gilcher
5/13/2008 1:44:00 PM
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I don't see your problem.
===
def test
str = "a*("
begin
re = /#{str}/
rescue RegexpError => e
# invalid regexp
"<span class='parser_error'>invalid regexp #{str.inspect}:
#{e.message}</span>"
end
end
puts test.inspect
===
doesn't print any errors. I double checked that warnings are on and
the warning level was set to highest.
If it does not work with your ruby version, please post the version
string of you ruby installation (obtained by "ruby -v").
Regards,
Florian Gilcher
On May 13, 2008, at 3:08 PM, Gaspard Bucher wrote:
> Hi there !
>
> Is there a way to disable regexp warning ?
>
> I want to do this:
>
> begin
> re = /#{str}/
> rescue
> # invalid regexp
> return "<span class='parser_error'>invalid regexp #{str.inspect}</
> span>"
> end
>
> without having tons of messages printed on stderr. Any clue ?
>
> Thanks,
>
> Gaspard
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
iEYEARECAAYFAkgpmyoACgkQJA/zY0IIRZbOSwCeNQelH1ZsQkg7wD6LjFtQwEwy
HYEAoKXytOhB9IkwM4HC7vaGpwkWzLaa
=CkEQ
-----END PGP SIGNATURE-----