procmail
[Top] [All Lists]

Re: why this is not working ?

2006-05-26 01:46:12
Matthias Haeker schreef:

i try to Match on something like
A B C D E F G
where each letter is separated to the next with a space

with

[^$WS][$WS][^$WS][$WS][^$WS][$WS][^$WS][$WS][^$WS][$WS][^$WS][$WS]

where $WS = $SPACE$TAB

i can get no MATCH

if i use


[^$WS]+[$WS]+[^$WS]+[$WS]+[^$WS]+[$WS]+[^$WS]+[$WS]+[^$WS]+[$WS]+[^$WS]+
[$WS]+

i  get  MATCH but  also on all  paragraphs  with  6 and more  Words

if i understand it right the + is for any sequence of one or more of
the leading letter
but i only want to catch single letter's separatet with a space

If everything you write there is true, then you are doing it right. So
you must be making invalid assumptions.

You didn't show your real code, nor any verbose logs, so we can not
check where you went wrong. Maybe you just forgot something like a $ at
the start of the condition line (happens to most of us).

Save the following as test.pr, make it executable (chmod 700 test.pr)
and run it as: test.pr < /dev/null
Don't forget to fix the literal tab.


#!/usr/bin/env procmail -m
# Filename: test.pr
# Run like: test.pr < /dev/null

  DEFAULT = '/dev/null'
  VERBOSE = 'off'      # change to 'on' to see more

  n     = '
' t     = '     '      # a literal tab

  b     = "[ $t]"      #  [[:blank:]]
  s     = "[ $t$n]"    #  [[:space:]]
  S     = "[^ $t]"     # [^[:space:]]

  a     = "[A-Za-z]"   #  [[:alpha:]]
  A     = "[^A-Za-z]"  # [^[:alpha:]]

  d     = "[0-9]"      #  [[:digit:]]
  D     = "[^0-9]"     # [^[:digit:]]

  w     = "[A-Za-z0-9_]"    #  [[:word:]]
  W     = "[^A-Za-z0-9_]"   # [^[:word:]]

  :0
  * 1^1 b ?? .
  { LOG = "\$b has length $= (should be 4)$n" }


  TEST = 'A B C D E F G'

  :0
  *$ TEST ?? ^$w$b$w$b$w$b$w$b$w$b$w$b
  { LOG = "TEST matched$n" }

-- 
Groet, Ruud


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>