LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 01: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, 02: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: 344Reputation: 344Reputation: 344Reputation: 344
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, 02: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, 05: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: 344Reputation: 344Reputation: 344Reputation: 344
Sorry, your question was on regular expressions, not postfix configuration. Perhaps someone familiar with postfix filtering can address this...
 
Old 02-15-2006, 05:26 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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, 06: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, 06:25 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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, 06:33 PM   #8
stomach
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 202

Original Poster
Rep: Reputation: 30
thank you Tinkster.
 
  


Reply



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 02:15 PM
little help for regexp EmOuBi Linux - Newbie 6 08-06-2005 02:19 AM
Regexp problem eremit Programming 6 06-23-2005 06:48 AM
Regexp question scuffell Programming 4 04-30-2005 03:35 AM
regexp help ... pld Programming 1 03-15-2005 03:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:27 PM.

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
Open Source Consulting | Domain Registration