Skip to content

Commit

Permalink
Merge pull request #148 from robmen/bug4513-modregex
Browse files Browse the repository at this point in the history
 WIXBUG:4513 - Fix condition keyword detection in modularization regex.
  • Loading branch information
barnson committed Oct 2, 2014
2 parents 3c5e416 + 6007721 commit ead7f24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions History.md
@@ -1,3 +1,5 @@
* RobMen: WIXBUG:4513 - Fix condition keyword detection in modularization regex.

## WixBuild: Version 3.9.901.0

* BobArnson: WIXBUG:4510 - Empty the post-reboot resume command line when recreating it.
Expand Down
4 changes: 2 additions & 2 deletions src/tools/wix/Row.cs
Expand Up @@ -578,7 +578,7 @@ internal string GetModularizedValue(Field field, string modularizationGuid, Hash
// to shred the entire condition into the identifiers that need to be
// modularized. Let's break it down piece by piece:
//
// 1. Look for the operators: NOT, EQV, XOR, OR, AND, IMP. Note that the
// 1. Look for the operators: NOT, EQV, XOR, OR, AND, IMP (plus a space). Note that the
// regular expression is case insensitive so we don't have to worry about
// all the permutations of these strings.
// 2. Look for quoted strings. Quoted strings are just text and are ignored
Expand All @@ -588,7 +588,7 @@ internal string GetModularizedValue(Field field, string modularizationGuid, Hash
// strings these enviroment variable references are ignored outright.
// 4. Match all identifiers that are things that need to be modularized. Note
// the special characters (!, $, ?, &) that denote Component and Feature states.
regex = new Regex(@"NOT|EQV|XOR|OR|AND|IMP|"".*?""|%[a-zA-Z_][a-zA-Z0-9_\.]*|(?<identifier>[!$\?&]?[a-zA-Z_][a-zA-Z0-9_\.]*)", RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
regex = new Regex(@"NOT\s|EQV\s|XOR\s|OR\s|AND\s|IMP\s|"".*?""|%[a-zA-Z_][a-zA-Z0-9_\.]*|(?<identifier>[!$\?&]?[a-zA-Z_][a-zA-Z0-9_\.]*)", RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);

// less performant version of the above with captures showing where everything lives
// regex = new Regex(@"(?<operator>NOT|EQV|XOR|OR|AND|IMP)|(?<string>"".*?"")|(?<environment>%[a-zA-Z_][a-zA-Z0-9_\.]*)|(?<identifier>[!$\?&]?[a-zA-Z_][a-zA-Z0-9_\.]*)",RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
Expand Down

0 comments on commit ead7f24

Please sign in to comment.