MrO Posted December 1, 2004 Posted December 1, 2004 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 Quote
coldfusion244 Posted December 1, 2004 Posted December 1, 2004 What exactly are you trying to do? Quote -Sean
HJB417 Posted December 2, 2004 Posted December 2, 2004 please post the input and the desired output. Quote
John_0025 Posted December 2, 2004 Posted December 2, 2004 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. ;) Quote
Richard Crist Posted December 21, 2004 Posted December 21, 2004 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. Quote nothing unreal exists .NET Framework Homepage ~ Visual C# Spec ~ C++/CLI Spec ~ Visual Basic .NET Spec
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.