[英]Excel - Extract all occurrences of a String Pattern + the subsequent 4 characters after the pattern match from a cell
[英]extract text from cells after string pattern in Excel
我有一个电子表格,每个单元格中都有大量数据,但我只想提取特定的信息,其中包括第一个日期,直到单词“ Base”为止:
从->
[extra data] 10APR18 [in between text] 11JUL18 [in between text] etc. Base [extra data]
到->
10APR18 [in between text] 11JUL18 [in between text] etc.
我不太熟悉所需的语法,但是我猜想它将提取所有内容的所有内容都包含在内:“(数字)(数字)(字母)(字母)(字母)(数字)(数字)”直到“基础”
如果有人能提出解决方案或向正确的方向指出,我将非常感激。 谢谢!
尝试这样的事情:
(\\d{2}[A-Za-z]{3}\\d{2}.*)Base
示例: https : //regex101.com/r/AO1qmW/1
说明:
(\\d{2}[A-Za-z]{3}\\d{2}.*)
-从日期开始捕获直到Base
\\d{2}
-匹配两位数字 [A-Za-z]{3}
-匹配三个字母,大写或小写 \\d{2}
-再匹配两位数字 .*
-匹配日期之后的所有内容(直到Base
为止) Base
-匹配Base
,但不捕获 您也可以使用积极的前瞻方式,不必担心捕获/不捕获组,因为您只会匹配所需的内容: \\d{2}[Az]{3}\\d{2}.*(?=Base)
唯一的区别是删除了组括号,并用(?=Base)
替换了Base
,如果前面的表达式后面跟有Base
,则匹配。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.