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
Post a Comment