3 ms·
> Modifiers (i for case-insenstive is the most important one) can appear inside a regex when preceded by a colon. For example, this Perl 5 regex: > (Male|Fema
by wott 9y ago
> Modifiers (i for case-insenstive is the most important one) can appear inside a regex when preceded by a colon. For example, this Perl 5 regex:
> (Male|Female) (?:[Cc][Aa][Tt]|[Dd][Oo][Gg])
> would be translated to Perl 6 as:
> (Male || Female) ' ' [:i cat || dog]
Perl 5 does support this feature:
(Male|Female) ((?i)cat|dog)
or:
(Male|Female) (?i:cat|dog)
- b2gills 9y agoAlso I would use ( Male | Female ) in Perl 6, as it tries to match both in parallel. The reason the version with || is in P5-to-p6 is that is how | works in Perl 5.