Minh wrote:This is why I hate RegEx's so much. Can someone explain the conditions for the 2 RegEx's here: I'll much appreciate it.
Regex aclQueryStringRegEx = new Regex(".*[&?]acl($|=|&).*");Regex torrentQueryStringRegEx = new Regex(".*[&?]torrent($|=|&).*");if (aclQueryStringRegEx.IsMatch(resource)){sb.Append("?acl");}else if (torrentQueryStringRegEx.IsMatch(resource)){sb.Append("?torrent");}
Matches any string that contains &acl (&torrent in second) or ?acl (?torrent) somewhere other than the beginning of the string, optionally followed by other arguments, the end of the string or an =... parameter.
So basically it is asking if the thing (which is probably, but not definitely and URL) contains a GET parameter torrent or acl respectively.
If it contains a get ACL parameter, sticks a ?acl to the end of sb, xor it contains a TORRENT parameter, sticks a ?torrent to the end of sb.