S5: perl5 regex flags

5 views
Skip to first unread message

Jonathan Lang

unread,
Oct 7, 2006, 6:28:04 PM10/7/06
to perl6language,
It's been indicated that several regex modifiers that are found in
Perl5 are gone. That's all well and good, unless you're using the
Perl5 modifier to port code to perl6. What happens if you're trying
to port in a regex that made use of one of the now-obsolete modifiers?
Bear in mind that there are new s and x modifiers that have nothing
to do with their perl5 homonyms.

Suggestion: let the Perl5 modifier take an optional argument that
consists of perl5-compatable, perl6-incompatable modifiers: m, s,
and/or x. The other regex-related perl5-compatable modifiers (e, g,
and o) have more to do with the match and substitute functions than
with the patterns themselves, and so can be updated to perl6 standards
without regard to the pattern used.

--
Jonathan "Dataweaver" Lang

Larry Wall

unread,
Oct 7, 2006, 6:36:48 PM10/7/06
to perl6language,
On Sat, Oct 07, 2006 at 03:28:04PM -0700, Jonathan Lang wrote:
: It's been indicated that several regex modifiers that are found in

: Perl5 are gone. That's all well and good, unless you're using the
: Perl5 modifier to port code to perl6. What happens if you're trying
: to port in a regex that made use of one of the now-obsolete modifiers?

You just put them inside with (?smx).

Larry

Jonathan Lang

unread,
Oct 7, 2006, 6:46:28 PM10/7/06
to perl6language,

Ah; gotcha. I had been under the impression that there were subtle
differences between (?msx) and //msx, such as the former allowing you
to turn the flags on or off mid-pattern. Not that it matters if you
put this at the front of the pattern...

--
Jonathan "Dataweaver" Lang

Reply all
Reply to author
Forward
0 new messages