Case Insensitive Replace Not Working
-
Its probably something to do with my RegEx but I can't get it to be case insensitive. My regex is
(\xAB" + col.ColumnName + "\xBB)
(The \xAB and \xBB are the double chevron quote chars) So my code block is:Regex regex = new Regex("(\xAB" + col.ColumnName + "\xBB)", RegexOptions.IgnoreCase);
docText = regex.Replace(docText, ds.Tables[0].Rows[0][col].ToString());I've also tried:
docText = Regex.Replace(docText, "(\xAB" + col.ColumnName + "\xBB)", ds.Tables[0].Rows[0][col].ToString(), RegexOptions.IgnoreCase);
What have I ballsed up? Something with the literal I imagine.
-
Its probably something to do with my RegEx but I can't get it to be case insensitive. My regex is
(\xAB" + col.ColumnName + "\xBB)
(The \xAB and \xBB are the double chevron quote chars) So my code block is:Regex regex = new Regex("(\xAB" + col.ColumnName + "\xBB)", RegexOptions.IgnoreCase);
docText = regex.Replace(docText, ds.Tables[0].Rows[0][col].ToString());I've also tried:
docText = Regex.Replace(docText, "(\xAB" + col.ColumnName + "\xBB)", ds.Tables[0].Rows[0][col].ToString(), RegexOptions.IgnoreCase);
What have I ballsed up? Something with the literal I imagine.
-
Easy enought to build a simple test program that verifies the regex, and only the regex. That of course would not have 'ds', 'Tables', etc.
mmm, it was nothing to do with the regex at all. Word had inserted some weird Bookmark XML in the middle of my text I was looking for. So the string I was looking for never appeared as a complete string in the xml. Can't find how to show these hidden things in Word though:(
-
mmm, it was nothing to do with the regex at all. Word had inserted some weird Bookmark XML in the middle of my text I was looking for. So the string I was looking for never appeared as a complete string in the xml. Can't find how to show these hidden things in Word though:(
-
mmm, it was nothing to do with the regex at all. Word had inserted some weird Bookmark XML in the middle of my text I was looking for. So the string I was looking for never appeared as a complete string in the xml. Can't find how to show these hidden things in Word though:(
-
mmm, it was nothing to do with the regex at all. Word had inserted some weird Bookmark XML in the middle of my text I was looking for. So the string I was looking for never appeared as a complete string in the xml. Can't find how to show these hidden things in Word though:(
-
mmm, it was nothing to do with the regex at all. Word had inserted some weird Bookmark XML in the middle of my text I was looking for. So the string I was looking for never appeared as a complete string in the xml. Can't find how to show these hidden things in Word though:(
-
mmm, it was nothing to do with the regex at all. Word had inserted some weird Bookmark XML in the middle of my text I was looking for. So the string I was looking for never appeared as a complete string in the xml. Can't find how to show these hidden things in Word though:(
-
mmm, it was nothing to do with the regex at all. Word had inserted some weird Bookmark XML in the middle of my text I was looking for. So the string I was looking for never appeared as a complete string in the xml. Can't find how to show these hidden things in Word though:(
-
mmm, it was nothing to do with the regex at all. Word had inserted some weird Bookmark XML in the middle of my text I was looking for. So the string I was looking for never appeared as a complete string in the xml. Can't find how to show these hidden things in Word though:(
-
mmm, it was nothing to do with the regex at all. Word had inserted some weird Bookmark XML in the middle of my text I was looking for. So the string I was looking for never appeared as a complete string in the xml. Can't find how to show these hidden things in Word though:(
-
mmm, it was nothing to do with the regex at all. Word had inserted some weird Bookmark XML in the middle of my text I was looking for. So the string I was looking for never appeared as a complete string in the xml. Can't find how to show these hidden things in Word though:(