[英]REGEX Match all except what comes after key word
New to Regex & Stack Overflow and finding it hard to get the hang of.刚接触 Regex 和 Stack Overflow,发现很难掌握。
I am trying to match all text except what comes after a keyword.我正在尝试匹配除关键字之后的所有文本。 Here is the scraped text from a site.
这是从网站上抓取的文本。 Javascript.
Javascript。 Unable to get rid of whitespace.
无法摆脱空白。 Is there a way to select all except what comes after 'Exterior Colour' for example?
有没有办法选择除“外观颜色”之后的所有内容?
I have tried looking around and have got as far as我试过环顾四周,已经到了
^((?!Engine).)* ^((?!Engine).)*
I need to select everything apart from 'Jet Black Metallic'.我需要选择除“Jet Black Metallic”之外的所有内容。 Does anyone have any pointers?
有没有人有任何指示? Would be greatly appreciated.
将不胜感激。
Try to use noncapturing group (?:...)
.尝试使用非捕获组
(?:...)
。
Your paritcular regexp would looks like this /.*?(?:Exterior Colour)/
您的特殊正则表达式看起来像这样
/.*?(?:Exterior Colour)/
Link to regex: https://regex101.com/r/hG81L5/1链接到正则表达式: https ://regex101.com/r/hG81L5/1
Thanks for everyone's help.感谢大家的帮助。 Managed to figure it out the formulae i was looking for is listed below.
设法弄清楚我正在寻找的公式如下所列。
Engine\S+.\S+.\S+( SKIP)( FAIL)|[^E] (?:E(?!ngine)[^E] )*引擎\S+.\S+.\S+( SKIP)( FAIL)|[^E] (?:E(?!ngine)[^E] )*
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.