On Tuesday 03 October 2006 16:05, Une bue wrote:
> Paul Lutus <nospam / nosite.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.*

Regexp.new('/.*rb/'[%r(/(.*?)/), 1])
# /.*rb/

>
>
> 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...