Given this text file:
Received: from unknown (HELO aws-bacon-delivery-svc-iad-1007.vdc.g.com) ([10.146.157.151]) by na-mm-outgoing-6102-bacon.iad6.g.com with E
Try this:
Code:
//var rePattern = new RegExp(/^Received:(.*)$/); var rePattern = new RegExp(/^Subject:(.*)$/); var arrMatches = strText.match(rePattern);
Result:
arrMatches[0] -> Subject: test arrMatches[1] -> test