Skip to content

Commit b5e7435

Browse files
committed
Merge pull request #488 from Azure/dev
HPF PR: dev <- Azure:dev
2 parents 4c0087d + 6511b3d commit b5e7435

File tree

1 file changed

+8
-43
lines changed

1 file changed

+8
-43
lines changed

src/ServiceManagement/RemoteApp/Commands.RemoteApp/Common/RemoteAppRegEx.cs

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,11 @@ public abstract partial class RdsCmdlet
4848
// explicit key name for OU element
4949
protected const string ouKeyRegexPattern = @"OU";
5050

51-
// all normal non quoted string chars, which includes all ASCII values in the range 0x20-0x126 except for escaped character for non quoted string, , \ <CR> = < > " # ; or +
52-
protected const string normalCharRegexPattern = @"[A-Za-z0-9 !\$%&'()\*\-\.\/\:\?@\[\]\^_`{\|}~]";
53-
54-
// valid escape characters for non quoted string, , \ <CR> = < > " # ; or +, or an 8 bit value encoded as a hex pair
55-
protected const string escapedCharRegexPattern = @"\\([ ,\\\r=<>""#;+]|[0-9A-Fa-f]{2})";
56-
57-
// ASCII code in hex, e.g. #ff
58-
protected const string asciiCodeRegexPattern = @"#([0-9A-Fa-f]{2})+";
59-
60-
// Unicode grapheme
61-
protected const string unicodeRegexPattern = @"(?>\P{M}\p{M}*)";
62-
6351
// used to separate entities, , or + followed by 0 or more spaces
6452
protected const string delimiterRegexPattern = @"[\+,]\s*";
6553

66-
// an entity value, consists of normal chars, escape codes and hex codes
67-
protected const string entityRegexPattern = @"(" + normalCharRegexPattern + @"|" + escapedCharRegexPattern + @"|" + asciiCodeRegexPattern + @"|" + unicodeRegexPattern + @")+";
54+
// an entity value, consists of characters other than , <CR> < > " # ; + =
55+
protected const string entityRegexPattern = @"([^,<>""#;+=\r\n])+";
6856

6957
// a key/entity pair, e.g DC=foo-bar.com
7058
protected const string keyEntityRegexPattern = @"(" + keyRegexPattern + @"=" + entityRegexPattern + @")";
@@ -87,21 +75,10 @@ public abstract partial class RdsCmdlet
8775
* The entity begins with a key which must begin with a letter and contains letters, digits, or hyphens
8876
* [A-Z][A-Z0-9\-]*=
8977
* (
90-
* The entity value contains any char except for the special chars , \ <CR> = < > " # ; or +
91-
* ([A-Za-z0-9 !\$%&'()\*\-\.\/\:\?@\[\]\^_`{\|}~])
92-
* |
93-
* Or an escaped special char , \ <CR> = < > " # ; + or a space, or an 8 bit ASCII code in hex
94-
* (\\([ ,\\\r=<>""#;+]|[0-9A-Fa-f]{2}))
95-
* |
96-
* Or a # followed by a sequence of 8 bit ASCII codes in hex
97-
* (#([0-9A-Fa-f]{2})+)
98-
*
99-
* Or a Unicode grapheme
100-
* (?>\P{M}\p{M}*)
101-
*
78+
* The entity value contains one or more characters except for the special chars , \ <CR> = < > " # ; or +
79+
* [^,<>""#;\+=\r\n]
10280
* There will be 1 or more characters matching this pattern
10381
* )+
104-
* )
10582
* Followed by a delimeter, either , or +
10683
* [\+,]\s*
10784
* There may be 0 or more entities matching this pattern
@@ -114,14 +91,8 @@ public abstract partial class RdsCmdlet
11491
* The entity key must match OU exactly. This guarantees the overall pattern contains at least oen OU element
11592
* OU=
11693
* (
117-
* The entity value contains any char except for the special chars , \ <CR> = < > " # ; or +
118-
* ([A-Za-z0-9 !\$%&'()\*\-\.\/\:\?@\[\]\^_`{\|}~])
119-
* |
120-
* Or an escaped special char , \ <CR> = < > " # ; + or a space, or an 8 bit ASCII code in hex
121-
* (\\([ ,\\\r=<>""#;+]|[0-9A-Fa-f]{2}))
122-
* |
123-
* Or a # followed by a sequence of 8 bit ASCII codes in hex
124-
* (#([0-9A-Fa-f]{2})+)
94+
* The entity value contains one or more characters except for the special chars , \ <CR> = < > " # ; or +
95+
* [^,<>""#;\+=\r\n]
12596
* There will be 1 or more characters matching this pattern
12697
* )+
12798
* )
@@ -135,14 +106,8 @@ public abstract partial class RdsCmdlet
135106
* The entity begins with a key which must begin with a letter and contains letters, digits, or hyphens
136107
* [A-Z][A-Z0-9\-]*=
137108
* (
138-
* The entity value contains any char except for the special chars , \ <CR> = < > " # ; or +
139-
* ([A-Za-z0-9 !\$%&'()\*\-\.\/\:\?@\[\]\^_`{\|}~])
140-
* |
141-
* Or an escaped special char , \ <CR> = < > " # ; + or a space, or an 8 bit ASCII code in hex
142-
* (\\([ ,\\\r=<>""#;+]|[0-9A-Fa-f]{2}))
143-
* |
144-
* Or a # followed by a sequence of 8 bit ASCII codes in hex
145-
* (#([0-9A-Fa-f]{2})+)
109+
* The entity value contains one or more characters except for the special chars , \ <CR> = < > " # ; or +
110+
* [^,<>""#;\+=\r\n]
146111
* There will be 1 or more characters matching this pattern
147112
* )+
148113
* )

0 commit comments

Comments
 (0)