Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Created·2019-02-17 06:49
Flavor·JavaScript

/
((?:[\t ]*(?:R|RE|F|FW|FWD):[\t ]*)*)(.*)
/
gmi
Open regex in editor

Description

C# Code Sample:

var subject = "RE: RE:Fw:             RE:FW: FWD: re: This is a message from a long thread re: asdf ";
var pattern = @"((?:[\t ]*(?:R|RE|F|FW|FWD):[\t ]*)*)(.*)";
var regex = new Regex(pattern, RegexOptions.ECMAScript | RegexOptions.IgnoreCase);
var match = regex.Match(subject);
var extracted = match.Groups[2].Value;

extracted value: This is a message from a long thread re: asdf

Submitted by safeer