[英]Exclude a portion of a string with regex
I have the string below: 我有下面的字符串:
Identification of the product - AZEC 产品识别-AZEC
How can I create a regex to exclude Identification of the product - and return only the string that comes next, in this case, AZEC 如何创建正则表达式以排除产品标识-仅返回下一个字符串,在这种情况下为AZEC
String str = "Identification of the product - AZEC";
System.out.println(str.split(" - ")[1]); // AZEC
I tried the one below and this seems to work: 我尝试了以下方法,这似乎可行:
(?m)(?<=\\bIdentification of the product - ).*$ (?m)(?<= \\ b产品标识-)。* $
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.