Forum: Ruby Re: Odd behavior of String#scan

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F3b7b8756d0c7f71cc7460cc33aefaee?d=identicon&s=25 Berger, Daniel (Guest)
on 2005-12-21 23:11
(Received via mailing list)
> > to:
> >     But this does two operations where it seems like one should
> > suffice. Does someone know of a way to do this in a single
> operation?
>
> I would suggest:
>
>    'abcSTARTdef,ghi,jkl,ENDmno'.match(/START(.*)END/)[1].split(',')
>
> I don't know of a way to accomplish it in one step.

I don't think it's possible without lookbehind assertions.  Maybe
Oniguruma supports this.

Regards,

Dan
This topic is locked and can not be replied to.