c# - .NET Regex pattern? -


var flashvars = {         "client.allow.cross.domain" : "0",          "client.notify.cross.domain" : "1", }; 

for strange reason does not want parsed code (in c#).

private void parsevariables() {        string page;        regex flashvars = new regex("var flashvars = {(.*?)}", regexoptions.multiline | regexoptions.ignorecase);        regex var = new regex(@"""(.*?)"",", regexoptions.multiline | regexoptions.ignorecase);        match flashvarsmatch;        matchcollection matches;        string vars = "";         if (!isloggedin)        {             throw new notloggedinexception();        }         page = request(url_client);         flashvarsmatch = flashvars.match(page);         matches = var.matches(flashvarsmatch.groups[1].value);         if (matches.count > 0)        {          foreach (match item in matches)          {             vars += item.groups[1].value.replace("\" : \"", "=") + "&";          }     } } 

use regexoptions.singleline rather regexoptions.multiline

regexoptions.singleline

specifies single-line mode. changes meaning of dot (.) matches every character (instead of every character except\n).

http://msdn.microsoft.com/en-us/library/443e8hc7(vs.71).aspx


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -