LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 02-15-2006, 02:12 PM   #1
stomach
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 202

Rep: Reputation: 30
regexp


Condition "OR" is represented with "|".
Code:
/^.*param|param2/
How I make command "AND" with regexp? Or either to enter in the necessary filter to have all the parametros in any place in the body of the email.

Code:
PARAM1 "AND" STOP "AND" PARAM2
 
Old 02-15-2006, 03:49 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
A logical and is usually performed by multiple stages. For example:

grep "PARAM1" | grep "STOP" | grep "PARAM2"

That is, in order to make it to the successive stages, the requirements of the preceding stages must have been satisfied.
 
Old 02-15-2006, 03:55 PM   #3
stomach
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 202

Original Poster
Rep: Reputation: 30
These parameters are for rejecting email in postfix.
/etc/postfix/body_checkes

grep in regexp?
 
Old 02-15-2006, 06:06 PM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
Sorry, your question was on regular expressions, not postfix configuration. Perhaps someone familiar with postfix filtering can address this...
 
Old 02-15-2006, 06:26 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,004
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Quote:
Originally Posted by stomach
Condition "OR" is represented with "|".
Code:
/^.*param|param2/
How I make command "AND" with regexp? Or either to enter in the necessary filter to have all the parametros in any place in the body of the email.

Code:
PARAM1 "AND" STOP "AND" PARAM2
Ummm ... if they come in the same sequence I don't
see the problem ...

Code:
 PARAM1.*STOP .*PARAM2

Cheers,
Tink
 
Old 02-15-2006, 07:09 PM   #6
stomach
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 202

Original Poster
Rep: Reputation: 30
the problem is that the necessary message is orderly.
example:
Code:
PARAM1.*STOP .*PARAM2

Code:
testing message PARAM1 and PARAM2.
It functions perfectly!


But if I to modify the message it stops:
Code:
testing message PARAM2 and PARAM1.
It does not go to function
 
Old 02-15-2006, 07:25 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,004
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
In that case you will have to bite the bullet and do something
very ugly (if the repeated greps are not an option):
Quote:
egrep "(PARAM1.*PARAM2|PARAM2.*PARAM1)"
This would (quite obviously) become very verbose with more parameters,
so a repeated grep is probably the better choice.


Cheers,
Tink
 
Old 02-15-2006, 07:33 PM   #8
stomach
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 202

Original Poster
Rep: Reputation: 30
thank you Tinkster.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
regexp help cliff76 Linux - Newbie 3 03-07-2008 03:15 PM
little help for regexp EmOuBi Linux - Newbie 6 08-06-2005 03:19 AM
Regexp problem eremit Programming 6 06-23-2005 07:48 AM
Regexp question scuffell Programming 4 04-30-2005 04:35 AM
regexp help ... pld Programming 1 03-15-2005 04:45 PM


All times are GMT -5. The time now is 08:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration