字符串的正则表达式是什么?

时间:2014-12-10 07:33:02

标签: regex string vbscript

以下是什么是正则表达式:

APPLICATION_CONTEXT.getBean("giisParameterFacadeService")

giisParameterFacadeService的部分是动态的。

我已经尝试过:

"APPLICATION_CONTEXT[.]getBean[(]""\s*""[)]"

但它不会返回任何内容。

编辑:将其更改为:\ w *

后发生错误

行:15。字符:8。错误:无效的过程调用或参数。码。 800A0005

Set objFSO = CreateObject("Scripting.FileSystemObject") 
Set file = objFSO.OpenTextFile("sample.txt" , ForReading)  
Const ForReading = 1

Dim re
Set re = new regexp 
re.Pattern = "APPLICATION_CONTEXT[.]getBean[(]""\w*""[)]"
re.IgnoreCase = True
re.Global = True

Dim line
Do Until file.AtEndOfStream
    line = file.ReadLine
    For Each m In re.Execute(line)
       Wscript.Echo m.Submatches(0)
    Next
Loop

2 个答案:

答案 0 :(得分:1)

其他选项(已测试here):

APPLICATION_CONTEXT\.getBean\(\"(.*)\"\)

答案 1 :(得分:0)

试试这个:

APPLICATION_CONTEXT\.getBean[(]""\w*""[)]"