x Did you like it? Well, then please consider making a donation :)

Regex (or Regexp), Regular Expressions - is a special set of rules that forms a search mask/pattern (mainly for use in work with strings: match, split, replace). Regular expressions are useful in parsing data from text files, websites (html code), xml etc. .NET Regex c#Regular expressions provide a high-power, flexible, and efficient method for processing text: for example get all email addresses from html-file or delete all phone numbers in a text document. The extensive pattern-matching notation of regular expressions enables you to quickly parse large amounts of text to find specific character patterns; to validate text to ensure that it matches a predefined pattern (such as an http link); to parse / extract, replace, edit or delete text substrings; and to add the extracted strings to a collection in order to generate a report. For many applications that deal with strings or that parse large blocks of text, regular expressions are an indispensable tool. Many programming languages provide regular expression capabilities, some built-in, for example Perl, JavaScript, Ruby, AWK, and Tcl, and others via a standard library, for example .NET C#, VB.NET, Java, Python etc.

Each character in a regular expression is either understood to be a metacharacter with its special meaning, or a regular character with its literal meaning. Together, they can be used to identify textual material of a given pattern, or process a number of instances of it that can vary from a precise equality to a very general similarity of the pattern. The pattern sequence itself is an expression that is a statement in a language designed specifically to represent prescribed targets in the most concise and flexible way to direct the automation of text processing of general text files, specific textual forms, or of random input strings. A very simple use of a regular expression would be to locate the same word spelled two different ways in a text editor.

A regex (regular expression) is a pattern that the regular expression engine attempts to match in input text. A pattern consists of one or more character literals, operators, or constructs. For a brief introduction, see .NET Framework Regular Expressions. Each section in this quick reference lists a particular category of characters, operators, and constructs that you can use to define regular expressions: anchors, backreference, character escapes, character classes, grouping constructs, quantifiers, substitutions, options and other.

The System.Text.RegularExpressions namespace contains set of classes that provide access to the .NET Framework regular expression engine. The namespace provides .NET regex functionality that may be used from any platform or language that runs within the Microsoft .NET Framework: C#, VB.NET. Learn more: Wikipedia, Microsoft MSDN, Help and Library.


Matches
If else condition on minus sign

If numbers are negative then length of numbers is 11 otherwise 12

mahajan344
4/14/2016 10:23:59 PM
Numbers from 0 to 100

Validate numbers from 0 to 100

mahajan344
4/14/2016 9:24:49 PM
Numbers from 0 to 100

Validate numbers from 0 to 100

mahajan344
4/14/2016 9:24:47 PM
Regex.Matches, Regular Expression for hexadecimal number

Matches expression starting with a 0, following by either a lower or uppercase x, followed by one or more characters in the ranges 0-9, or a-f, or A-F.

stackoverflow
8/14/2015 1:07:13 PM

Replace
borderlands.wiki add template param

nitrogeniy
1/12/2017 9:58:57 PM
Remove "Style" attribute from HTML tags

Remove all "style" attributes from HTML text.

admin
8/12/2015 5:47:50 PM
How do I replace multiple spaces with a single space?

Replace multiple spaces example

stackoverflow
7/12/2015 4:10:18 PM
Remove all non alphanumeric characters from a string except dash & space symbol

Replace this Regex with an empty string + Compiled flag

stackoverflow
7/12/2015 3:52:40 PM

Split
Split string to get Date and text

I have to process text file like that: text 01/01/1970 text 02/01/1970 ... etc. I want the output to be the following data: according to the docs, wrapping the string you're splitting on in () (making it a capture group) will result in these captures being included in the array.

stackoverflow
8/12/2015 4:38:43 PM
Splitting Link using RegEx

i want to find category from the link. I am breaking the link into array using Regex.

admin
3/31/2015 5:40:43 PM
Simple Regex.Split sample - remove digits

User \d+ for remove digits and \D+ for remove text.

admin
3/30/2015 12:45:18 AM

Last REFERAL links

TimeFromViews
10/19/2018 1:44:40 PMhttp://qaru.site/questions/145460/get-all-links-on-html-page regex #14
10/16/2018 10:57:48 AMhttps://duckduckgo.com/ regex #1,  regex #2,  regex #3,  regex #4,  regex #57
9/24/2018 8:24:59 AMhttps://www.bing.com/ regex #1,  regex #2,  regex #3,  regex #421
9/8/2018 3:52:45 PMhttp://www.bing.com/search?q=c%23+regex+online+tester&form=MSNH14&sc=8-4&sp=-1&qs=n&sk= regex #14
9/1/2018 9:36:49 PMhttp://www.baidu.com/s?wd=neededoi9 regex #11
9/1/2018 4:43:07 PMhttps://www.cjb.net/ regex #1,  regex #2,  regex #3,  regex #4,  regex #5,  regex #6,  regex #7,  regex #8,  regex #99
7/7/2018 6:39:16 PMhttp://stackoverflow.com/questions/787932/using-c-sharp-regular-expressions-to-remove-html-tags regex #1,  regex #2405
6/6/2018 10:13:02 PMhttp://www.baidu.com/s?wd=SX41 regex #11
6/4/2018 6:15:03 AMhttp://www.baidu.com/s?wd=K6KH regex #11
6/3/2018 1:32:29 AMhttp://www.baidu.com/s?wd=principles77 regex #11
4/27/2018 11:14:16 AMhttp://www.bing.com/search?q=123+456+789+1011+1213+1415+1&form=MSNH14&sc=8-4&sp=-1&qs=n&sk= regex #11
4/21/2018 3:00:28 PMhttp://askdev.info/questions/199339/using-c-sharp-regular-expressions-to-remove-html-tags regex #112
4/10/2018 12:08:13 AMhttps://in.search.yahoo.com/ regex #11
4/4/2018 1:28:40 AMhttp://www.baidu.com/s?wd=P3TR regex #11
4/1/2018 3:32:25 PMhttp://www.baidu.com/s?wd=7GR regex #11
3/18/2018 8:14:09 AMhttp://www.baidu.com/s?wd=5SSL regex #11
3/16/2018 6:10:50 PMhttp://www.baidu.com/s?wd=XHQ regex #11
3/14/2018 3:49:06 PMhttp://www.baidu.com/s?wd=LXH regex #11
3/3/2018 7:10:32 AMhttp://www.bing.com/search?q=System.Text.RegularExpressions+Regexoptions+example&form=MSNH14&sc=8-4&sp=-1&qs=n&sk= regex #11
2/23/2018 10:51:29 AMhttps://mx.search.yahoo.com/ regex #11
1/30/2018 5:29:29 AMhttp://qaru.site/questions/45373/using-c-regular-expressions-to-remove-html-tags regex #11
1/29/2018 1:38:50 PMhttp://www.baidu.com/s?wd=L6W regex #11
1/24/2018 3:23:54 PMhttp://www.baidu.com/s?wd=OU46 regex #11
1/23/2018 12:18:36 PMhttp://www.baidu.com/s?wd=EB1H regex #11
1/21/2018 12:20:24 PMhttp://www.baidu.com/s?wd=V1G regex #11
1/20/2018 7:16:41 AMhttp://www.baidu.com/s?wd=N94N regex #11
1/18/2018 8:02:50 AMhttp://www.baidu.com/s?wd=MPP regex #11
11/21/2017 9:07:22 AMhttps://search.yahoo.com/ regex #1,  regex #2,  regex #35
11/14/2017 4:17:16 AMhttp://r.duckduckgo.com/ regex #11
11/3/2017 6:17:42 AMhttp://www.bing.com/search?q=system.text.regularexpressions.regex+tester&src=IE-SearchBox&FORM=IENTTR&conversationid= regex #11