Rosetta Code/Find bare lang tags: Difference between revisions

Content added Content deleted
m (Reverted edits by SqrtNegInf (talk) to last revision by Thundergnat)
m (Reverted edits by Thundergnat (talk) to last revision by SqrtNegInf)
Line 1,352: Line 1,352:
(formerly Perl 6)
(formerly Perl 6)
{{trans|Perl}}
{{trans|Perl}}
The only tricky thing here is the use of the <tt>ms</tt> form of match, short for <tt>m:sigspace</tt>. This causes whitespace in the regex to be considered "significant", that is, it matches optional whitespace at those positions, as if you'd put <tt>\s*</tt> there. Of course, the regexes themselves are in Perl 6 syntax, which is quite different from Perl 5 regex syntax (and arguably much cleaner). Regex syntax is perhaps the area in which Perl 6 diverges most from Perl 5.
The only tricky thing here is the use of the <tt>ms</tt> form of match, short for <tt>m:sigspace</tt>. This causes whitespace in the regex to be considered "significant", that is, it matches optional whitespace at those positions, as if you'd put <tt>\s*</tt> there. Of course, the regexes themselves are in Raku syntax, which is quite different from Perl 5 regex syntax (and arguably much cleaner). Regex syntax is perhaps the area in which Raku diverges most from Perl 5.
<lang perl6>my $lang = '(no language)';
<lang perl6>my $lang = '(no language)';
my $total = 0;
my $total = 0;