#1
|
|||
|
|||
need help with regular expression match
Hello-
I've never used regular expressions and this is frustrating the heck out of me... I have a text file where I'm trying to use a Replace in File call to replace "Version=1.0.5.0" in multiple locations in the file (not including the quotes). The text is in multiple locations in the file, and not necessarily at the beginning or the end of the line. The 1.0.5.0 can be any number- for example it can be 1.0.6.0 or 2.99.3.0. Up to three digits between each "." Anyone know how I search for this? I've tried all sorts of things, but other than "Version=", I can't get anything to work... I've tried Version=([0-9]|[0-9][0-9]|[0-9][0-9][0-9]).([0-9]|[0-9][0-9]|[0-9][0-9][0-9]).([0-9]|[0-9][0-9]|[0-9][0-9][0-9]).([0-9]|[0-9][0-9]|[0-9][0-9][0-9]) also, from what I read, perhaps Version=(\d+).(\d+).(\d+).(\d+) Also, I really don't understand the what \ , ^ etc. do- or if I need one of those characters at the beginning. Thanks much for any help! |
#2
|
|||
|
|||
See attached sample. For more help with regular expressions, see http://www.kinook.com/VisBuildPro/Manual/regex.htm
|
#3
|
|||
|
|||
Great- thanks! It appears that your example doesn't use the regular expression syntax, correct?
After a couple of hours mucking around with regular expressions, I still don't understand much about them! Oh well... Now for my follow-up question: Is there a way to examine a .dll or .exe and obtain it's version # information? Thanks! |
#4
|
|||
|
|||
[vbld_FSO.GetFileVersion("%WINSYSDIR%\user32.dll")]
http://www.kinook.com/VisBuildPro/Ma...xpressions.htm http://www.kinook.com/VisBuildPro/Ma...scriptfile.htm |
#5
|
|||
|
|||
Thanks for the info on the GetFileVersion.
The match on Version=* isn't quite working- it's chopping off the rest of the line of text- beyond Version=1.0.1.0 Here's a sample section: <section name="applicationConfigurationManagement" type="Microsoft.ApplicationBlocks.ConfigurationMan agement.ConfigurationManagerSectionHandler,Microso ft.ApplicationBlocks.ConfigurationManagement, Version=1.0.1.0,Culture=neutral,PublicKeyToken=7be 9c45ae0061408" /> So I probably do need to use regular expression matching, correct? I need a little hand holding on that- I've been unable to get even the simplist matching to work- say just searching for Version=1 where 1 can be 1-9. I think I must have something simple wrong with the syntax. I've read the help over and over again, read web pages on regular expressions- I can't get anything to work... Any chance you could show me what to put in to search for Version=x where x is 1-9? Thanks a bunch- you've been a big help already...! |
#6
|
|||
|
|||
Attached.
|
#7
|
|||
|
|||
Wow, that's a concise match expression. I think I just barely understand it- but it works great!
Thanks again for all your help! AL |
|
|