find 2 patterns on 1 line

MrO

New member
Joined
Dec 1, 2004
Messages
1
Hi

i use the following pattern:
^(@@@)(.+)(@@@)^

It works perfect if i have 1 pattern per line, but i have 2 patterns i get (@@@var1@@@ stuff @@@var2@@@):

var1@@@ stuff @@@var2

while it should be
var1
var2

can anyone help me? tnx
 
In my opionion its best to avoid (.*) or (.+) in your expressions or better still avoid . altogther. This is really VERY generic and is what is causing your problem.
You need to be more specific about what characters you want to match between the @@@ bits in your text.

The @ character will be matched by the (.+) part of the expression and the program will try to match the largest string it can find.

You need to make your expression say that the @ character can not be included between the @@@ tags. This will make your expression a lot longer. ;)
 
regex OR functionality

If you want to search for text containing "something" or "other" on the same line you would use the following:

something|other

The "|" vertical bar character is used to indicate one thing or another in regex.
 
Back
Top