Kinook Software Forums

Kinook Software Forums (http://www.kinook.com/Forum/index.php)
-   [VBP] User Tips, Tricks and Samples (http://www.kinook.com/Forum/forumdisplay.php?f=19)
-   -   Regular expression in conditional build rule? (http://www.kinook.com/Forum/showthread.php?t=4945)

Rogier 12-14-2011 11:44 AM

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?

kinook 12-14-2011 12:07 PM

1 Attachment(s)
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

Rogier 12-14-2011 06:32 PM

Awesome, thanks!


All times are GMT -5. The time now is 09:54 PM.


Copyright 1999-2019 Kinook Software, Inc.