Click here to Skip to main content
15,868,052 members
Everything / General Programming / Regular Expressions

Regular Expressions

regular-expression

Great Reads

by Christoph Buenger
Describes PHP application development with the free Scavix Web Development Framework (Scavix-WDF).
by honey the codewitch
Build a feature rich, non-backtracking regular expression engine and code generator in C#
by honey the codewitch
Embed fast streaming C# code to match text based on inputted regular expressions
by Daniel Vaughan
A Visual Studio regex to remove someone's overzealous use of regions in VS. Find and replace: (^.*\#region.*$)|(^.*\#endregion.*$) Remember to enable regular expressions in the Visual Studio find and replace dialog.

Latest Articles

by honey the codewitch
Easily add lexers to your project with this simple drop in NuGet package and a few annotations
by honey the codewitch
In this article, we explore the inner workings of Visual FA
by honey the codewitch
Continuing in the Visual FA series, now we explore API fundamentals
by honey the codewitch
In this article, we will use my Visual FA solution to explore finite automata concepts used for finding patterns in text.

All Articles

Sort by Score

Regular Expressions 

23 Nov 2009 by Daniel Vaughan
A Visual Studio regex to remove someone's overzealous use of regions in VS. Find and replace: (^.*\#region.*$)|(^.*\#endregion.*$) Remember to enable regular expressions in the Visual Studio find and replace dialog.
18 Oct 2011 by George Swan
The Regex method uses comma, full stop, hyphen, and apostrophe as word separators. The problem with this is that these characters are not universally used as separators. The hyphen is used to join two words. Could I suggest the following?string input = "Mr O'Brien-Smith arrived at 8.30 and...
5 Jan 2011 by Bryian Tan
ASP.NET Password Strength Regular Expression. Customize n numbers of upper case, digits, special characters.
19 Dec 2010 by PIEBALDconsult
How about loading it into an XmlDocument and getting the InnerText? (Provided the HTML is well-formed XML, of course.)
20 Dec 2010 by JHoye
Consider using the open source HTML Agility Pack library (htmlagilitypack.codeplex.com).It lets you use XPATH queries to access very specific parts of an HMTL document, and the HTML does not have to be valid, well-formed XML. In addition to accessing the raw inner text of an element you can...
6 Sep 2014 by Marco Bertschi
A walk-through on how a Key-Value pair can be parsed using a PERL-compatible regex engine
5 Jan 2011 by MarcoBot
NOTE: If you're really wanting plain text, then you should also be sure to decode the HTML entities (System.Web.HttpUtility.HtmlDecode()) on the resulting text, or you'll wind up with HTML/XML character entity text in your output, such as & and [ If you're going to immediately output the...
8 Feb 2011 by Bryian Tan
How to extract the text from a hyperlink and preserve other HTML tags
25 Oct 2011 by Jacobs76
I also use a Regex expression to count words, which returns the same number of words as MS Word. I wrap the Regular Expression in a String extension method to make it easy to use.public static class StringExtensions{ /// /// WordCounts Regular Expression /// ...
15 Feb 2012 by Andreas Gieriet
I think the following Regex and HtmlDecode would do:string html = ...;string textonly = HttpUtility.HtmlDecode( Regex.Replace(html, @"|", ""));Any HTML construct that would not be stripped off properly by this?
18 Jan 2011 by KevinAG
Sorry, but I have to vote this way down. Your regular expression (or @Chris's) is not robust enough for what I would consider "real world" data. Especially if this is used on any kind of public web site, I would be afraid of JavaScript injection attacks and other things (depending on its usage)....
6 Dec 2011 by FDW
This is less expensive:For any of the next strings, it gives 8:"Mr O'Brien-Smith arrived at 8.30 and spent \t $1,000.99"" Mr O'Brien-Smith arrived at 8.30 and spent \t $1,000.99""Mr O'Brien-Smith arrived at 8.30 and spent \t $1,000.99 "" Mr O'Brien-Smith arrived at 8.30 and...
8 Feb 2012 by jsc42
\S does not / did not work on all versions of RegExp on Microsoft JScript / VBScript (sorry to be vague - I just recall having to avoid it because it was flakey). Instead you could try Start([.|\n]*)End (match everything except newline and newline)Update: Checked some old code: I could...
10 Apr 2021 by Marijan Nikic
Regex that can be used for parsing Cron Expressions
28 May 2012 by Bryian Tan
Regular Expression to validate the file path and extension and it is compatible with JavaScript and ASP.NET
30 Jan 2012 by Chris Maunder
".*" may not be what you want in multi-line strings
25 May 2014 by M@dHatter
Custom Javascript replaceAll() using prototype with Case Insensitive Matching!
17 Oct 2011 by Pete O'Hanlon
Over the last couple of days I've seen numerous examples of people posting about how to count words in a sentence. Disturbingly, these postings recommend suggest counting the number of spaces in the sentence and use that as the basis of a word count.You may be asking why this is a problem. Well,...
22 Oct 2013 by Yuriy Nelipovich
The LogJoin tool helps to collect any unstructured data from text files and join it to a simple table representation for easy analysis.
20 Feb 2017 by Henryk Filipowicz
20 Feb 2013 by Joezer BH
A simple regex that replaces ALL the illegal filename or path chars
4 Sep 2011 by Ed Nutting
IIS_ASPNet_URLRewriting
30 Jan 2012 by Matt T Heffron
For .NET and Perl Regex: Instead of changing the Regex pattern, use the RegexOptions.Singleline (.NET) or "s" modifier (Perl). This enables "." to match newline.
22 Apr 2014 by Marco Bertschi
A quick overview why you should abandon Qt's QRegExp class and move on to use QRegularExpression
6 May 2015 by FrostedSyntax
Learn how to use regular expressions to find addresses or parts of an address in a given string. These patterns can also be used to verify that a given string is a true address.
30 Dec 2010 by santosh poojari
To remove or replace multiple special character from string using sql queries.
14 Feb 2012 by Andreas Gieriet
A "single-liner" to decode quoted-printable data.
12 Mar 2014 by Artur Ampilogov
Tip for testing numeric inputs with special Unicode symbols.
14 Jun 2015 by Marco Bertschi
A short Reference on how you can validate a registry-formatted GUID with a regular expression
17 Dec 2014 by Brad Joss
SQL CLR Functions for Zip Compression and Regular Expression evaluations
20 Aug 2022 by Brian C Hart
Example of how to use the caret (^) in Regexes that have specific matching requirements
12 Nov 2012 by killing the bug softly...
While developing a web page in fully HTML controls, you may not be able to use ASP.NET's controls, then you may need the help of some JavaScript function for validation.
17 Oct 2012 by jahmani
How to extract the inner text from HTML using a Regular Expression.
1 Jan 2010 by Brady Kelly
Not only is this very good advice, but also an excellent read. Various reasons to not use RegEx on HTML.[^]
11 May 2015 by FrostedSyntax
This tip provides you with several RegEx find and replace patterns to search through and alter HTML and CSS.
7 Oct 2010 by Mahendra Kumar Srivastava
Gives splitted values taking csv string as input.