在Perl6中,不间断空格被视为空格。所以
在Perl6中,不间断空格被视为空格。
say 'Perl 6' ~~ / / # Please understand there's a no-break space in the middle
生成Null regex not allowed
解决方案是引用字符,像这样
say 'Perl 6' ~~ / ' ' / ; # OUTPUT: «「 」»
但是,如果您想将不间断空格包含在字符类中,则不能使用该方法:
$str ~~ /<[ & < > " ' { ]>/ )
我可以使用Zs
,它是一个空格分隔符,但那个似乎过于宽泛了...还有其他方法吗?引用也没有帮助。问题是,在那里应该使用哪个字符类?