VBScript RegEx group match with back reference issue -


i have line in web.config follows

<clientdependency loggertype="xxx.clientdependencies.logger,strattonwebshared" version="144"> 

what trying write script checks code base modifications , updates clientdependency module version 1 if found. code bit increase version 1 follows

set clientdepregexp = new regexp     clientdepregexp.ignorecase = true     clientdepregexp.global = true     clientdepregexp.pattern = "(<clientdependency.*version=\"")(\d+)(\"".*)"      '1 = open file reading     set clientdependencyconfigfile = filesystemobject.opentextfile(targetfile, 1)      filecontents = clientdependencyconfigfile.readall      clientdependencyconfigfile.close      filecontents = clientdepregexp.replace(filecontents, "$1" & cint("$2") + 1 & "$3") 

my problem last line. $2 version number , doing cint("$2") + 1 giving me 3 (so 2 + 1 is). if use "$2" returning 144 (refer first line version number). question if wana quick arithmatic inside replace how should it?

thanks in advance tips ans suggestions can provide

change code that:

set clientdepregexp = new regexp set fso = new scripting.filesystemobject clientdepregexp     .ignorecase = true     .global = true     .pattern = "(<clientdependency[^<>]*?version="")(\d+)\b"     filecontents = fso.opentextfile(targetfile).readall     tmp = .replace(reftext, "$2")     filecontents = .replace(reftext, "$1" & cstr(val(tmp) + 1)) end 

hope work.


Comments