home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

Help with a regular expression

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2606
Discussions: 200,997, Posts: 2,379,952, Members: 246,365
Old November 12th, 2004, 04:42 AM   Digg it!   #1 (permalink)
Junior Member
 
Join Date: Nov 2004
Posts: 1
Question
Help with a regular expression

Hi,

I'm trying to match a series of terms in a boolean expresion like this:
medicinal AND clinical AND behavoiural

I made this regular expresion, and I cannot understand what am I doing wrong, since it matches the whole sentence, but it only gathers the first and the last terms...

([\S]+)( AND ([\S]+))+

Matches:
Group(0) = medicinal AND clinical AND behavoiural
Group(1) = medicinal
Group(2) = AND behavoiural
Group(3) = behavoiural

Any suggestions ??

Thanks in advance.
rofranco is offline   Reply With Quote
Old November 12th, 2004, 05:27 AM     #2 (permalink)
Ultimate Member
 
Join Date: Oct 2001
Location: Augsburg, Germany
Posts: 5,586
Yes. It's "behavioural"

Oh, and welcome here!

Now over to those who haven't forgotten their regexp stuff yet ...
Peter M is offline   Reply With Quote
Old November 12th, 2004, 02:32 PM     #3 (permalink)
Senior Member
 
James T's Avatar
 
Join Date: Jul 2004
Location: New Zealand
Posts: 582
Yes the regexp is correctly interpreting your string. Remember most regexps are greedy by default.
James T is offline   Reply With Quote
Old November 12th, 2004, 02:51 PM     #4 (permalink)
Senior Member
 
James T's Avatar
 
Join Date: Jul 2004
Location: New Zealand
Posts: 582
Personally I'd use perl's split /AND/, "stuff AND to AND split" instead, much easier. This is the sort of thing perl is good at.

perl -e 'print split /\s+AND\s+/, "yo AND dude AND hows AND my AND car\n";'

Last edited by James T : November 12th, 2004 at 08:04 PM. Reason: added the perl line
James T is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Access: Passing values from a form to a parameter query NoLimit Webmastering and Programming 5 December 15th, 2003 06:12 PM
how is the "find" algorithm in text editors constructed? zskillz Webmastering and Programming 6 October 4th, 2003 01:03 AM
Date Expression in Access Marvinator Applications and Operating Systems 5 April 3rd, 2003 01:12 PM
VB coding in Access SlipGun Webmastering and Programming 9 May 14th, 2002 12:25 AM
need to create a binary expression tree recursively... need help zskillz Webmastering and Programming 1 April 8th, 2002 03:08 PM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (3092)
Charges against non-tippers dropped.. (22)
Foxconn Blackops x48 MoBo (5)
Health Care Rationing (16)
Nvidia GTX 260 problem (14)
Delete an OS (17)
Laptop with wireless problem. (13)
Wireless Televisions. (12)
windows vista security holes (19)
CPU fan stops spinning randomly (11)
Regular Build (11)
Point and Shoot Camera Suggestions. (9)
[F@H SPAM 11/16/09] ! 1/2 months to.. (41)
windows 7 problem (7)
Recent Discussions
panasonic dmr ez48veb recorder (0)
add ram to existing (3)
Need help getting speakers to work (2)
Nvidia GTX 260 problem (14)
Laptop with wireless problem. (13)
Point and Shoot Camera Suggestions. (9)
Is the PSU I received dead? (16)
FreeAgent drive software not x64 comp.. (1)
Intel 5100 AGN issues fixed yet? (28)
Foxconn Blackops x48 MoBo (5)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (41)
Print spooler problem (17)
Q9650 vs. Q9550 (2)
Desktop Calendar Application (2)
Looking for new motherboard (1)
soundmon.exe (8)
Jedi Academy Problem (3)
Can a page file be "too big".. (1)
Size after cutting 700Mb file is 2.5 .. (0)
Delete an OS (17)
windows vista security holes (19)
updating BIOS via winflash, claims fi.. (1)
New Server Configuration Suggestions (0)
cheap gaming laptop? (12)
Unallocated Space (2)


All times are GMT -4. The time now is 12:07 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28