LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 06-05-2002, 03:38 PM   #1
Silly22
LQ Newbie
 
Registered: Mar 2002
Location: Edmonton, AB
Distribution: Mandrake 10.2, Ubuntu 6.10
Posts: 26

Rep: Reputation: 15
regex stumper


Alright, I got a tough cookie for all'ya.

eg.
1. <kewl>@ 342pleaseHELP #
%</kewl>

2. <kewl>@ 342please #
%</kewl>

I need to make a regex pattern that will match only number 2. And yes those are supposed to be on 2 different lines (new lines).

I tried in VIM the following:
/<kewl>\(.\|\n\)*<\/kewl>

That ends up finding both 1. and 2.

So i tried:
/<kewl>\([^a-z]\|.\|\n\)*<\/kewl>
and
/<kewl>\(.\|\n\([^a-z]\)\)*<\/kewl>

That didn't work.

Is there a logical "BUT" or "AND" operator in regular expressions. I mean regex is based on set theory! Where's the AND operator? How about quantifier scoping? I need an "AND NOT" operator!! Very frustrated.
 
Old 06-10-2002, 10:52 PM   #2
lackluster
Member
 
Registered: Apr 2002
Location: D.C - USA
Distribution: slackware-current
Posts: 488

Rep: Reputation: 30
&& is and || is or I think (or maybe the bitwise style & |).... I'm still learning RexExp.

/^<kewl>[@] \d{3}\w{6} #\n<\/kewl>$/

won't work? If not, can somebody explain why as I want to learn about this.
 
Old 06-10-2002, 11:27 PM   #3
lackluster
Member
 
Registered: Apr 2002
Location: D.C - USA
Distribution: slackware-current
Posts: 488

Rep: Reputation: 30
or
/^<kewl>[@] \d{3}\w{6} #\n$^<\/kewl>$/

I don'
t know if you can use ^ and $ twice though
 
Old 07-07-2002, 05:03 PM   #4
kervin
Member
 
Registered: Jan 2002
Location: Melbourne, FL.
Distribution: redhat
Posts: 168

Rep: Reputation: 30
I regular expression that matches two numbers...
[0-9]{2}

maybe if you said what exactly you're trying to do...
 
Old 07-07-2002, 05:10 PM   #5
pickledbeans
Member
 
Registered: Jun 2002
Location: Bailey, CO
Distribution: Slackware
Posts: 483

Rep: Reputation: 31
And what you were using to write it with: Perl, sed, awk, Borne
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex Help cmfarley19 Programming 5 03-31-2005 10:13 PM
Here's a stumper for you - error regarding crc_ccitt MDesigner Linux - Networking 1 02-23-2005 07:52 PM
Keymap Stumper Stranger Linux - Hardware 5 03-02-2004 01:56 AM
Regexp stumper lackluster Programming 2 11-02-2002 12:31 AM
Linux Expert Qwestion Stumper: Garunteed to stump linux experts or your money back! psyklops Linux - General 28 09-10-2002 09:05 AM


All times are GMT -5. The time now is 05:11 AM.

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