gpt4 book ai didi

java - java 正则表达式 X 的示例? , X?+ 和 X?

转载 作者:行者123 更新时间:2023-12-01 17:21:02 24 4
gpt4 key购买 nike

有人能给出 X? 之间的区别吗? , X?+X??以java为例。哪里X? , X?+X??java.util.regex.Pattern .

对于所有三种模式,他们都给出了相同的解释( X ,一次或根本没有)引用http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

我在互联网上找不到好的例子

注意:今天早上我在这里问了部分问题:what is the difference between the patterns X? and X? ,因为我再次发布了更新

最佳答案

这就是我喜欢的思考方式 -

X??   Negative bias, 0 or 1 time - preference to 0 if possible

X? Neutral bias, 0 or 1 time

X?+ Positive bias, 0 or 1 time - preference to 1 if possible,
and if 1 won't give it up (backtrack)

关于java - java 正则表达式 X 的示例? , X?+ 和 X?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18770203/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com