> i check this regex with grep, it work fine but in postfix no. > > grep -E "^Reference No: PP-[0-9][0-9][0-9]+(-[0-9]+)*.$" test.txt > > Reference No: PP-425-168-292 > > warning: header Subject: Reference No: PP-425-168-292 > > /^Subject: ^Reference No: PP-[0-9][0-9][0-9]+(-[0-9]+)*.$/ DISCARD > > any ideas?
- In the last example you have a caret at the beginning of both Subject and Reference. - There is a period a the end between the asterisk and dollar sign. That means there has to be exactly one character after the last number. Is this a requirement? You could simplify it as "Reference No: PP(-[0-9]+)+” unless it is mandatory that the first group of digits is exactly three characters. If they all are you could use {3,3} instead of the first plus. You could also use {1,3} if they are variable length. You can do the same to the second plus as it is the count of groups including the dash. (I didn’t test any of these. It’s been a while since I last wrote regexps so I might be rusty.) -- Cheers Petri https://metis.fi/en/petri tel:+358400505939
smime.p7s
Description: S/MIME cryptographic signature