0
Function VeriBul(BaslangicDegeri,BitisDegeri)

  Set RegEx = New RegExp
  RegEx.IgnoreCase = True
  RegEx.Global = True
  RegEx.Pattern = "(" & BaslangicDegeri & ")(.+?)(" & BitisDegeri & ")"
  Set Sonuc = RegEx.Execute(Mid(strRetval,29600,254000))

  For Each i in Sonuc
 VeriBul =  VeriBul & tr2(i.SubMatches(1))

    Set RegEx2 = New RegExp
    RegEx2.IgnoreCase = True
    RegEx2.Global = True
    RegEx2.Pattern = "(<hemenalfiyat>)(.+?)(</hemenalfiyat>)"
    Set Sonucx = RegEx2.Execute(Mid(strRetval,33000,2000))

     For Each y in Sonucx
     VeriBul2 =  VeriBul2 & tr2(y.SubMatches(1))
     Next

     When it works then appering error

  Next

==================================================== ====

For Each i in Sonuc
  i.SubMatches(1)

For Each y in Sonucx
  y.SubMatches(1)

  Next
  Next

除了 Submatches 代码,我如何打印这个?因为我有两个这样的正则表达式代码(所以我用作 Regex2),我不能再次使用子匹配。

谢谢,

4

1 回答 1

0

如果没有其余代码(tr2)以及您的输入和所需的输出,很难解决这个问题,但我认为您的代码应该是这样的

Function VeriBul(BaslangicDegeri,BitisDegeri)

  Set RegEx = New RegExp
  RegEx.IgnoreCase = True
  RegEx.Global = True
  RegEx.Pattern = "(" & BaslangicDegeri & ")(.+?)(" & BitisDegeri & ")"

  Set RegEx2 = New RegExp
  RegEx2.IgnoreCase = True
  RegEx2.Global = True
  RegEx2.Pattern = "(<hemenalfiyat>)(.+?)(</hemenalfiyat>)"

  Set Sonuc = RegEx.Execute(Mid(strRetval,29600,254000))
  Set Sonucx = RegEx2.Execute(Mid(strRetval,33000,2000))

  For Each i in Sonuc
    VeriBul =  VeriBul & tr2(i.SubMatches(1))
  Next
  For Each y in Sonucx
   VeriBul =  VeriBul & tr2(y.SubMatches(1))
  Next

Next
于 2012-06-12T21:17:07.920 回答