Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-17-2009, 03:22 PM
LrngToFly LrngToFly is online now
Registered User
 
Join Date: 08-20-2008
Posts: 7
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!
Reply With Quote
  #2  
Old 06-17-2009, 03:32 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
See attached sample. For more help with regular expressions, see http://www.kinook.com/VisBuildPro/Manual/regex.htm
Attached Files
File Type: bld replacever.bld (691 Bytes, 1512 views)
Reply With Quote
  #3  
Old 06-17-2009, 03:53 PM
LrngToFly LrngToFly is online now
Registered User
 
Join Date: 08-20-2008
Posts: 7
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!
Reply With Quote
  #4  
Old 06-17-2009, 03:57 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
[vbld_FSO.GetFileVersion("%WINSYSDIR%\user32.dll")]

http://www.kinook.com/VisBuildPro/Ma...xpressions.htm
http://www.kinook.com/VisBuildPro/Ma...scriptfile.htm
Reply With Quote
  #5  
Old 06-18-2009, 08:38 AM
LrngToFly LrngToFly is online now
Registered User
 
Join Date: 08-20-2008
Posts: 7
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...!
Reply With Quote
  #6  
Old 06-18-2009, 08:59 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Attached.
Attached Files
File Type: bld replacever2.bld (915 Bytes, 1574 views)
Reply With Quote
  #7  
Old 06-18-2009, 10:43 AM
LrngToFly LrngToFly is online now
Registered User
 
Join Date: 08-20-2008
Posts: 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
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 09:17 AM.


Copyright © 1999-2023 Kinook Software, Inc.