[英]How do I match any character across multiple lines in a regular expression for Atom Editor?
I wrote a RegEx to match any character across multiple lines between two tags in Atom.我写了一个 RegEx 来匹配 Atom 中两个标签之间多行的任何字符。
This is my RegEx:这是我的正则表达式:
<column name=\"body\">([\s\S]*)<\/column>
This is the content of my file:这是我的文件的内容:
<column name="body">Lorem ipsum dolor 1.
Si stante, hoc natura videlicet vult;
Est, ut dicis, inquam.</column>
<column name="body">Lorem ipsum dolor 2.
Si stante, hoc natura videlicet vult;
Est, ut dicis, inquam.</column>
Unfortunately the RegEx matches everything.不幸的是,正则表达式匹配一切。 What am i doing wrong?我做错了什么?
Try adding the "non-greedy" ?
尝试添加“非贪婪” ?
quantifier, like this:量词,像这样:
<column name=\"body\">([\s\S])*?<\/column>
It will make the ([\\s\\S])
capture group match as few times as possible.它将使([\\s\\S])
捕获组匹配尽可能少的次数。 Without the ?
没有?
, it will match as many as possible. ,它将匹配尽可能多的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.