Rick Strahl's Web Log

Wind, waves, code and everything in between...
ASP.NET • C# • HTML5 • JavaScript • AngularJs
Contact   •   Articles   •   Products   •   Support   •   Search
Ad-free experience sponsored by:
ASPOSE - the market leader of .NET and Java APIs for file formats – natively work with DOCX, XLSX, PPT, PDF, images and more

WebLog Posts in Category RegEx

Lookbehind in Regex searches

Regex's more esoteric features are easy to miss as they make sense to me only in a context that applies to my work. I've certainly read about lookahead and lookbehind before but until I needed it today and was pointed to look at this functionality in the Regex engine it just didn't sink in. Lookbehind allows matching or not matching of a string before the the string you are interested in. It effectively allows you to look for values that don't have x before another match which is actually quite common.

Expanding Urls with RegEx in .NET

I frequently need to parse and auto-expand URLs inside of user input. Here's the routine I use to do this.