我想一次性替换以下内容。
With regEx_
.Global = True
.MultiLine = True
.IgnoreCase = True
.Pattern = "xxxxxx(.*)[\r\n]+xxxxxx"
TextLine = regEx_.replace(TextLine, "xxxxxx$1,")
.Pattern = "xxxxxx(.*)[\r\n]+xxxxxx"
TextLine = regEx_.replace(TextLine, "xxxxxx$1,")
.Pattern = "xxxxxx(.*)[\r\n]+xxxxxx"
TextLine = regEx_.replace(TextLine, "xxxxxx$1,")
.Pattern = "xxxxxx(.*)[\r\n]+xxxxxx"
TextLine = regEx_.replace(TextLine, "xxxxxx$1,")
End With
Ides是划界线
例如:
来自此,
xxxxxx1
xxxxxx2
xxxxxx3
xxxxxx4
对此。
xxxxxx1,2,3,4
我想重复,直到找不到匹配为止。
修改
行在字符串中不是唯一的,而是strin的一部分,如
yzyzyz#
xxxxxx1
xxxxxx2
xxxxxx3
xxxxxx4
yzyzyz*
xxxxxx1
xxxxxx2
答案 0 :(得分:1)
您可以使用类似全局标志的内容:
input.replace(/[\r\n]+xxxxxx/g, ',')
// output: xxxxxx1,2,3,4
使用VBScript,它看起来像这样:
Dim TextLine, regEx_
TextLine = "xxxxxx1" & VbCrLf & _
"xxxxxx2" & VbCrLf & _
"xxxxxx3" & VbCrLf & _
"xxxxxx4"
Set regEx_ = new regexp
With regEx_
.Global = True
.MultiLine = True
.IgnoreCase = True
.Pattern = "[\r\n]+xxxxxx"
TextLine = regEx_.replace(TextLine, ",")
End With