Relative Content

Tag Archive for c#regex

Matching word boundary does not work in C

I am trying to find out whether a full word, say test, exists in a sentence and I’d like to do it in a case-insensitive manner. I took advantage of regex capabilities in C and used b in the pattern. Here is the program

Matching a fixed position in a string using C++ regex

Do C++ regular expressions have a way to refer to a fixed position within a string? I am looking for a notation that is (fictitiously) shown in the following example as @n, where n is the index of the following character:

Use regex in C# to replace single and double quotation marks with smart quotation marks

I am creating a text heavy game and the text-based content currently has non-smart (“, ‘) quotation marks but we want there to be smart (“, ”, ‘, ’) quotation marks. I hard programmed a loop to do this conversion during runtime but a regex approach could be far more suitable than my hefty loop. I’ve found it quite difficult to generate any good regular expressions (given a general lack of skill in the regex department).