List Info

Thread: shell, ruby and regexp




shell, ruby and regexp
user name
2006-10-03 07:05:11
Paul Lutus <nospamnosite.zzz> wrote:

> 
> What's wrong with the original string enclosed in
quotes?
> 
> Instead of:
> 
> ruby test_args.rb /to.*/
> 
> Type this instead:
> 
> ruby test_args.rb "/to.*/"

ok i've done THE MISTAKE to rememeber zsh as a priority over
ruby )))

my answer to "What's wrong with the original string
enclosed in quotes?"

that didn't work, my script sees it as a string and even if
(for this
arg and if enclosed with //) :

this_arg=Regexp.new(this_arg)

then if this arg = "/to.*/"

i get :

puts this_arg.source # (after Regexp.new)

# => /to.*/ INSTEAD OF to.*


the reason why i make no use of // for a regexp arg then i'm
obliged to
have another arg yelling if this arg is or not a regexp.

may be here i've missed something too...
-- 
une bévue

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )