相关疑难解决方法(0)

如何将Perl5/PCRE转换为Perl 6正则表达式?

只是为了得到这一点的方式,我使用index,substr或类似的,因为他们是我的特殊情况下,显而易见的解决办法,但我正在做grammar,所以我只能用regex.:(

话虽如此,关于将Perl5/PCRE正则表达式转换为Perl6正则表达式的建议无论如何都是很好的SO内容,因为Perl 6越来越受欢迎,它的正则表达式引擎非常不同.


这是一个正则表达式,只匹配一个不包含任何给定字符列表的字符串.
(试试吧.)

^(?:(?!\/).)*$
^            # assert position at start of string
(?:          # begin a noncapturing group 
   (?!       # negative lookahead: following regex must not match the string
      \/     # literal forward slash
    )        # end negative lookahead
    .        # any character, once
 )*          # the previous noncapturing group, 0..Inf times
 $           # assert position at end of string
Run Code Online (Sandbox Code Playgroud)

显然,由于多种原因,在Perl 6中不起作用.

基于上述原因,我希望在Perl 6使用此这里就是我试图要翻译成的基础上,CTRL-F荷兰国际集团 …

regex pcre perl6

8
推荐指数
2
解决办法
345
查看次数

如何找到一个不在另一个特定单词之前的单词?

我可以使用哪个正则表达式来查找所有字符串bar前面没有字符串foo?在两者之间有空格也是非法的.

所以正则表达式应匹配以下字符串

foo is bar
hello bar
Run Code Online (Sandbox Code Playgroud)

但不是这些

foobar
foo     bar
Run Code Online (Sandbox Code Playgroud)

我尝试过使用以下内容

(?!<foo)bar
Run Code Online (Sandbox Code Playgroud)

它完成了消除工作foobar,但我需要照顾空白,当然

(?!<foo)\s*bar
Run Code Online (Sandbox Code Playgroud)

匹配所有字符串.

谢谢!

php regex perl regex-negation

7
推荐指数
1
解决办法
2533
查看次数

标签 统计

regex ×2

pcre ×1

perl ×1

perl6 ×1

php ×1

regex-negation ×1