[英]issue to detect first matching end of string with regex
我试图找到以“start”开头并以以下字符串之一结尾的字符串:(, |. | finish) 后跟“not”或“here”时跳过“finish”。
这是示例:
CONF: For this charaxter start 6 years of this Revision 01 its indicated in the house warranty not finish for received days completion. affected you. of your face
为此,我使用了以下正则表达式:
(start|START).*(?!not finish|here)(?=[.]|[,]|finish)
我的尝试链接: https://regex101.com/r/USaH6I/1
要求的回报是:
start 6 years of this Revision 01 its indicated in the house warranty not finish for received days completion
但我得到了:
start 6 years of this Revision 01 its indicated in the house warranty not finish for received days completion, affected you
如果您的意思是在“完成”之后找到“这里”或“不”时跳过匹配,请尝试以下操作:( (?:start|START).*?(?=[.]|[,]|(finish (?!here|not)))
在这里测试: https://regex101.com/r/PaXBKL/1
如果你的意思是如果在 'finish' 之前找到 'here' 或 'not' 则跳过匹配,那么试试这个: (?:start|START).*?(?=[.]|[,]|((?<!here|not) finish))
这些遵循您停止时或时的条件。 被发现。
案例:
当首先找到“完成”时:
CONF:对于此版本 01 的此字符开始 6 年,其在房屋保修中表示在收到的天数内未完成,在此完成。 影响了你。 你的脸
当“完成”后跟“此处”/“不”时,它将跳到 a ,
or .
发现:
CONF:对于此字符,此版本 01 开始 6 年,其在房屋保修中注明不是收到的天数,在这里完成。 影响了你。 你的脸
CONF:对于此版本 01 的 6 年开始的这个角色,其在房屋保修完成时表示不是,收到天数在这里完成。 影响了你。 你的脸
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.