* fancy split regexp?
@ 2002-05-08 18:48 Josh Huber
2002-05-08 18:58 ` Bryan
0 siblings, 1 reply; 7+ messages in thread
From: Josh Huber @ 2002-05-08 18:48 UTC (permalink / raw)
I must be being pretty dense here -- perhaps someone could help me
out. Here's the rule:
("Resent-To"
"\\(.+\\)@packages\\.qa\\.debian\\.org"
"mail.debian.pts.\\1")
This does not work.
Variations on this, such as .*, [a-z-_]+ (or *), \\w+, etc do not
work! The versions with * always seem to match nothing, and the
message would be split into mail.debian.pts., the versions with +
always seem to match e: mail.debian.pts.e
The message I'm using for testing has this header:
Resent-To: developers-reference@packages.qa.debian.org
This works fine:
(let ((str "developers-reference@packages.qa.debian.org"))
(string-match "\\<\\(.*\\)@packages\\.qa\\.debian\\.org\\>" str)
(match-string 1 str))
=> "developers-reference"
What could possibly be going on here?
--
Josh Huber
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: fancy split regexp?
2002-05-08 18:48 fancy split regexp? Josh Huber
@ 2002-05-08 18:58 ` Bryan
2002-05-08 19:26 ` Josh Huber
0 siblings, 1 reply; 7+ messages in thread
From: Bryan @ 2002-05-08 18:58 UTC (permalink / raw)
My guess is that this has to do with the fact that nnmail-split-it
uses re-search-backwards to do it's pattern matching.
BrYan
Josh Huber <huber@alum.wpi.edu> writes:
> I must be being pretty dense here -- perhaps someone could help me
> out. Here's the rule:
>
> ("Resent-To"
> "\\(.+\\)@packages\\.qa\\.debian\\.org"
> "mail.debian.pts.\\1")
>
> This does not work.
>
> Variations on this, such as .*, [a-z-_]+ (or *), \\w+, etc do not
> work! The versions with * always seem to match nothing, and the
> message would be split into mail.debian.pts., the versions with +
> always seem to match e: mail.debian.pts.e
>
> The message I'm using for testing has this header:
>
> Resent-To: developers-reference@packages.qa.debian.org
>
> This works fine:
>
> (let ((str "developers-reference@packages.qa.debian.org"))
> (string-match "\\<\\(.*\\)@packages\\.qa\\.debian\\.org\\>" str)
> (match-string 1 str))
>
> => "developers-reference"
>
> What could possibly be going on here?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: fancy split regexp?
2002-05-08 18:58 ` Bryan
@ 2002-05-08 19:26 ` Josh Huber
2002-05-08 19:39 ` Paul Jarc
0 siblings, 1 reply; 7+ messages in thread
From: Josh Huber @ 2002-05-08 19:26 UTC (permalink / raw)
Bryan <bilko@onebabyzebra.com> writes:
> My guess is that this has to do with the fact that nnmail-split-it
> uses re-search-backwards to do it's pattern matching.
Hmm, okay.
That really sucks. I'm trying to fiddle with re-search-backward, but
I can't seem to get it to go past the word boundry (-) in
developers-reference. I always get reference out.
I'll look into it further ;)
thanks,
--
Josh Huber
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: fancy split regexp?
2002-05-08 19:26 ` Josh Huber
@ 2002-05-08 19:39 ` Paul Jarc
2002-05-08 21:51 ` Josh Huber
0 siblings, 1 reply; 7+ messages in thread
From: Paul Jarc @ 2002-05-08 19:39 UTC (permalink / raw)
Josh Huber <huber@alum.wpi.edu> wrote:
> I'm trying to fiddle with re-search-backward, but I can't seem to
> get it to go past the word boundry (-) in developers-reference. I
> always get reference out.
Try this:
("Resent-To"
"\\`\\(.*[^!#-'*+/-9=?A-Z^-~-]\\)?\\([!#-'*+/-9=?A-Z^-~-]*\\)@packages\\.qa\\.debian\\.org"
"mail.debian.pts.\\2")
paul
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: fancy split regexp?
2002-05-08 19:39 ` Paul Jarc
@ 2002-05-08 21:51 ` Josh Huber
2002-05-10 9:46 ` Kai Großjohann
0 siblings, 1 reply; 7+ messages in thread
From: Josh Huber @ 2002-05-08 21:51 UTC (permalink / raw)
prj@po.cwru.edu (Paul Jarc) writes:
> Try this:
> ("Resent-To"
> "\\`\\(.*[^!#-'*+/-9=?A-Z^-~-]\\)?\\([!#-'*+/-9=?A-Z^-~-]*\\)@packages\\.qa\\.debian\\.org"
> "mail.debian.pts.\\2")
Oh dear god...
Can we somehow use re-search-forward for splitting? I tried this (the
above regexp), and it works in a scratch buffer, but not in the
fancy-split-rules. In fact, any time I try and use \\` it seems to
never match.
So, I gave up... (oh, and I found another header to match on ;):
(defun jmh::pts-group (base)
(goto-char (point-min))
(when (re-search-forward "^X-PTS-Package: \\(.*\\)$" nil t)
(concat base "." (match-string 1))))
and use it like so:
(: jmh::pts-group "mail.debian.pts")
probably slower, but I fell a lot better about it :)
Thanks for ideas,
--
Josh Huber
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: fancy split regexp?
2002-05-08 21:51 ` Josh Huber
@ 2002-05-10 9:46 ` Kai Großjohann
2002-05-10 15:23 ` Josh Huber
0 siblings, 1 reply; 7+ messages in thread
From: Kai Großjohann @ 2002-05-10 9:46 UTC (permalink / raw)
Josh Huber <huber@alum.wpi.edu> writes:
> Can we somehow use re-search-forward for splitting? I tried this (the
> above regexp), and it works in a scratch buffer, but not in the
> fancy-split-rules. In fact, any time I try and use \\` it seems to
> never match.
Sure, \\` only matches at beginning of buffer. But most mail
addresses are not at the beginning of the buffer. For example, the
header name comes before the address.
kai
--
Silence is foo!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: fancy split regexp?
2002-05-10 9:46 ` Kai Großjohann
@ 2002-05-10 15:23 ` Josh Huber
0 siblings, 0 replies; 7+ messages in thread
From: Josh Huber @ 2002-05-10 15:23 UTC (permalink / raw)
Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:
> Sure, \\` only matches at beginning of buffer. But most mail
> addresses are not at the beginning of the buffer. For example, the
> header name comes before the address.
Ah, of course.
I guess my point still stands -- since we use re-search-backward it
makes regexps for matching addresses pretty disgusting...IMHO. Or,
near impossible.
Taking a peek at nnmail-split-it, I'm not ready to start screwing with
that code for fear in breaking people's split rules. =)
perhaps another time.
--
Josh Huber
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2002-05-10 15:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-08 18:48 fancy split regexp? Josh Huber
2002-05-08 18:58 ` Bryan
2002-05-08 19:26 ` Josh Huber
2002-05-08 19:39 ` Paul Jarc
2002-05-08 21:51 ` Josh Huber
2002-05-10 9:46 ` Kai Großjohann
2002-05-10 15:23 ` Josh Huber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).