例子: 这只是一个简单的句子。
我想匹配这句话和句子之间的每个字符。换行符应该被忽略。我想不出正确的语法。
例子: 这只是一个简单的句子。
我想匹配这句话和句子之间的每个字符。换行符应该被忽略。我想不出正确的语法。
当前回答
以下是我的做法: 这对我来说比试图找出特定的必要正则表达式更容易。
int indexPictureData = result.IndexOf("-PictureData:");
int indexIdentity = result.IndexOf("-Identity:");
string returnValue = result.Remove(indexPictureData + 13);
returnValue = returnValue + " [bytecoderemoved] " + result.Remove(0, indexIdentity); `
其他回答
用这个:(?=开始名)(?=结束名)
试试This is[\s\ s]*?句子,工作在javascript
如果有人在Jenkins上下文中寻找这样的例子。它会解析build.log,如果找到匹配,就会失败。
import java.util.regex.Matcher;
import java.util.regex.Pattern;
node{
stage("parse"){
def file = readFile 'build.log'
def regex = ~"(?s)(firstStringToUse(.*)secondStringToUse)"
Matcher match = regex.matcher(file)
match.find() {
capturedText = match.group(1)
error(capturedText)
}
}
}
以下是我的做法: 这对我来说比试图找出特定的必要正则表达式更容易。
int indexPictureData = result.IndexOf("-PictureData:");
int indexIdentity = result.IndexOf("-Identity:");
string returnValue = result.Remove(indexPictureData + 13);
returnValue = returnValue + " [bytecoderemoved] " + result.Remove(0, indexIdentity); `
在VIM中快速搜索,你可以使用 在Vim控制提示符:/这是。*\_.*句子