Re: RFC 164 (v2) Replace =~, !~, m//, s///, and tr// with match(), subst(), and trade()
[email protected] (Nathan Wiger) Thu, 14 Sep 2000 08:47:24 -0700
| Newsgroups | perl.perl6.language.regex |
|---|---|
| Message-ID | <[email protected]> |
> What's next, replace the regex syntax with something that more closely > ressembles the rest of Perl? No. > Regexes are a language within the language. And not a tiny one. I know... :-) > So, if regexes are such a completely different sublanguage, I can see > the m// and s/// syntax as just a link between these two entirely > different worlds. I don't care that it has a weird syntax itself. That, > by itself, simply stresses the fact that regexes are indeed "different". One thing to remember is that regex's are already used in a number of functions: @results = grep /^VAR=\w+/, @values; @array = split /\s*:\s*/, $input; So I don't think there's that much difference just standardizing on this as: @output = trade /$input/$output/, @strings; $num = match /\w+/, @these; Plus you can now easily work with arrays, which you can't currently. That being said, please read the whole RFC, since it provides a means for 100% backwards-compatible syntax. That way, existing regex lovers (myself included) can stuff use the "true Perl way". ;-) Plus, since =~ winds up being generalized (RFC 170) it is extensible to other operations as well. -Nate