Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] User Tips, Tricks and Samples

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-14-2011, 10:44 AM
Rogier Rogier is online now
Registered User
 
Join Date: 09-09-2004
Location: the Netherlands
Posts: 40
Regular expression in conditional build rule?

You can put conditional rules on build steps by selecting 'Build only if macro or expression...' and then there's options like 'is true', 'contains (x)', 'is not equal to (y)' etc.

It would be really great if you could add 'matches regexp (x)' and 'does not match regexp (y)' there!

Or is there some other way to pull this off?
Reply With Quote
  #2  
Old 12-14-2011, 11:07 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,003
Create a project or global script function something like this:

Code:
Function MatchesRegEx(s, regex)
  Set e = New RegExp
  e.IgnoreCase = True
  e.Global = True
  e.Pattern = regex
  MatchesRegEx = e.Test(s)
End Function
and call it from the build rule using a script expression (see the attached sample).

12/14/2011 10:07:24 AM: Building project step 1 - Test num...
12/14/2011 10:07:24 AM: Building project step 2 - Test str...
12/14/2011 10:07:24 AM: Step skipped
Attached Files
File Type: bld regex_rule.bld (741 Bytes, 2753 views)
Reply With Quote
  #3  
Old 12-14-2011, 05:32 PM
Rogier Rogier is online now
Registered User
 
Join Date: 09-09-2004
Location: the Netherlands
Posts: 40
Thumbs up

Awesome, thanks!
Reply With Quote
Reply

Tags
condition , regexp , regular expression , rule

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 12:13 AM.


Copyright © 1999-2023 Kinook Software, Inc.