using variable n regex c# -


this question has answer here:

         var d = new date();         string[] weekday = new string[10];         weekday[0] = "söndag";         weekday[1] = "måndag";         weekday[2] = "tisdag";         weekday[3] = "onsdag";         weekday[4] = "torsdag";         weekday[5] = "fredag";         weekday[6] = "lördag";         int day = (int)datetime.now.dayofweek;         var n = weekday[day];          var match = regex.match(item.innertext, @"\b" + n + "\s(.*)\s(.*)\s(.*)", regexoptions.multiline);          response.write(match.value); 

i "unrecognized escape sequence" error on \s(.)\s(.)\s(.) when put in variable. works fine when it's @"\bmåndag\s(.)\s(.)\s(.)", regexoptions.multiline);

you can use @ regex

var match = regex.match(item.innertext, @"\b" + n + @"\s(.*)\s(.*)\s(.*)", regexoptions.multiline); 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -