in reply to regular expression- match a string

Since (\S+) means to capture all contiguous non-whitespace, the part that gets captured must end when the RE engine encounters a space after "forward".

You're successfully capturing a space into $1, and "forward" into $2.

The RE you probably seek is:

/^Subject:\s+(\S.*)$/
That way you capture beginning with the first non-space character after "Subject: ", and continue your match, including whitespace between words, through the end of the line. $1 will contain your subject.


Dave