Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

In my opionion it's 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. ;)

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...