什么是在括号 + 静态文本中提取值的正则表达式命令?
What is the regex command to extract values within a parentheses + static text?
我已经对我的文件进行了足够的修剪,以提取特定值 + 值后跟的静态文本。
Test Listing CDO (56 Custom Object Records)
我想从该行中获取 56 Custom Object Records
。我试过 (?<=\).+?(?=\Custom Object Records))
似乎不起作用。
使用这个正则表达式 (pcre):
\(\K[^\)]+
例如:
$ grep -oP '\(\K[^\)]+' file
56 Custom Object Records
我已经对我的文件进行了足够的修剪,以提取特定值 + 值后跟的静态文本。
Test Listing CDO (56 Custom Object Records)
我想从该行中获取 56 Custom Object Records
。我试过 (?<=\).+?(?=\Custom Object Records))
似乎不起作用。
使用这个正则表达式 (pcre):
\(\K[^\)]+
例如:
$ grep -oP '\(\K[^\)]+' file
56 Custom Object Records