Forum Moderators: open
^( From¦Subject¦Date):
The alternation is constrained by the parentheses, so literally, this regex means
ômatch the start of the line, then one of!From",!Subject", or!Date", and then match
!: ".ö Effectively, it matches:
1) start-of-line, followed by F r o m, followed by `: '
or 2) start-of-line, followed by S u b j e c t, followed by `: '
or 3) start-of-line, followed by D a t e, followed by `: '
Putting it less literally, it matches lines beginning with `From: ', `Subject: ', or
`Date: ', which is quite useful for listing the messages in an email åle.
The online evaluation tool I was using can be found here. [projects.aphexcreations.net] And supports a number of languages not just JavaScript. Switching the language switch to JavaScript and testing some test text in the text box I only got the word "From" as outlined in the quote above. Let me specify my test text. Here it is.
orFrom: elvis@tabloid.org (The King)From:
Subject: be seein' ya around Subject:
Ignoring Differences in Capitalization
Date: Thu, 22 Aug Date: 2002 11:04:13 Date:
Ignoring Differences in Capitalization Date:
From: The Prez president@whitehouse.gov
Ignoring Differences Subject: in Capitalization
Date: Tue, 27 Aug 2002 8:36:24
Subject: now, about your vote
So what does this mean. Can I use my book effectively to help me learn regular expressions as used in JavaScript. Can you suggest any other sources of intense regular expression dissection the way it would be used in JavaScript. Obtaining this book took some effort which I would not want to waste. So please give me your best advice.
Sincerely
Marc
I almost exclusively use multiple online information sources, and seldom get what I need from a single "clearinghouse."
(W3Schools [w3schools.com] is pretty close, though).
I tend to look up my regexes here [zvon.org].
Because of the differences in parsing engines, I seldom take any reference at face value, and always have to experiment.
[edited by: jatar_k at 4:29 am (utc) on Mar. 10, 2007]