You need to sign in to do that
Don't have an account?
msneller
Regular Expression and Matcher issues
Does anyone know why this will not find the match.
I'm running this code
public string cleanEmail(String body){ String result; system.debug(body); String RegExp = '(?m).*^From:.*\\n^Sent:.*\\n^To:.*\\n^Subject:.*'; Matcher m = Pattern.compile(RegExp).matcher(body); if (m.matches()) { Integer position = m.start(); result = body.substring(0, position); }else{ result = 'No match'; } return result; }
The string "body" equals the following and should find a match.
email Test 6
From: xxxxx@xxxxxx.com
Sent: Wednesday, December 11, 2013 7:07 AM
To: 'xxxxx@xxxxxx.com'
Subject: FW: Case email testing
Junk
I abandoned the matcher. Here is my solution