正则表达式 – 在字符类中包含不间断的空格
发布时间:2020-12-14 06:26:00 所属栏目:百科 来源:网络整理
导读:在Perl6中,不间断空间被认为是空间,所以 say 'Perl6' ~~ / / # Please understand there's a no-break space in the middle 产生 Null regex not allowed 解决方案是引用角色,就像这样 say 'Perl6' ~~ / '' / ; # OUTPUT: ????? 但是,如果要在字符类中包含不
在Perl6中,不间断空间被认为是空间,所以
say 'Perl6' ~~ / / # Please understand there's a no-break space in the middle 产生 Null regex not allowed 解决方案是引用角色,就像这样 say 'Perl6' ~~ / '' / ; # OUTPUT: ????? 但是,如果要在字符类中包含不间断的空格,则不起作用: $str ~~ /<[ & < > " ' { ]>/ ) 我可以使用
尝试:
$str ~~ /<[ & < > " ' { xA0 ]>/ 或更具可读性: $str ~~ /<[ & < > " ' { c[NO-BREAK SPACE] ]>/ (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |