What flavor or regex does Ruby use?

I’m used to “Perl flavor” being used in the different languages I have experience with, so, knowing the basics, I haven’t looked too deeply into differences until I need to.

I was under the impression that the modifier “g” meant “greedy” not “global”.

But it seems it means global
Lines ~85 - 90

What have I missed?

Looks like Perl.

This syntax is borrowed from Perl. Ruby supports the following modifiers:

/g means global in Perl as well.

The “g” stands for “global”, which tells Perl to replace all matches, and not just the first one.

There are different modifiers that are greedy. + and * both are I think.


It looks like my understand of “greedy” (match modifier vs. pattern modifier) was muddled.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.