You may come across an instance in your C# and ASP.NET programming where you need to download an external webpage and parse the meta tags... specifically, the "Title," "Meta Description...
If you want to remove invalid chars "* . " / \ [ ] : ; | = ," from file name below is the code which can help you Sample code: using System; using System.IO; using System.Text.RegularEx...
In this blog I will show how to replace single backslash with double backslash in a string with REGEX. Let's say we have a string "This is \ test \ string" and we want to replace single ...
In this blog I will show how to replace uppercase letter with "underscore and the letter "in a string with REGEX. Let's say we have a string "ThisIsTestString" and we want to r...
In this blog I will show how to replace underscores with hyphens in a string with REGEX. Let's say we have a string "This_is_test_string" and we want to replace underscores with hyphens ...
In this blog I will show how to get number only from a string with REGEX. Let's say we have a string "Hello 123456789 user 456 welcome." and we want the output to be "123456789456&q...
In this blog I will show how to validate a string to allow alphanumeric characters only in a string with REGEX. Below is the sample code to do the same: using System; using System.Text.RegularExpressi...
In this blog I will show how to remove all non numeric characters from a string with REGEX. Let's say we have a string "(912)-555-7777" and remove all non numeric characters so that the ...
In this blog I will show how to remove all non alpha numeric characters from a string with REGEX. Let's say we have a string "Hello!@#$123456789~~-_user456welcome" and remove all non alp...
In this blog I will show how to reverse all numbers in string with REGEX. Let's say we have a string "Hello 123456789 user 456 welcome." and we want to reverse it like "Hello 987654...
I encountered a piece of code where regex replacement was done in the following way: Regex.Replace(@"\d+", m => new string(m.Value.Reverse().ToArray())); It was giving the following e...
In this blog I will show how to replace multiple spaces with a single space with REGEX. Let's say we have a string "a b c d e f g" and we want to replace multiple spaces with a single sp...
Let's say we have a string and we want to match that string not containing a word say alpha . I have used Regex class in order to do so
While parsing one of my regex pattern based on input data I was getting the following error: RegEx: Quantifier {x,y} following nothing error I was having the following code: string pattern = string.Fo...