473,699 Members | 2,333 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to seperate words?

79 New Member
Hi all,

I have a query like this:-

((A AND B) NOT (C AND D) AND (N OR M) NOT (E AND F))

I want to store
((A AND B) AND (N OR M)) in one array.

(C AND D) NOT (E AND F) in other array.

means NOT terms in one array other terms in other array in perl.

How do i do that?

pls help me.

with regards
Archana
Sep 10 '07 #1
9 1603
KevinADC
4,059 Recognized Expert Specialist
I am totally confused by your question. Have you tried any code yet we can look at?
Sep 10 '07 #2
Archanak
79 New Member
basically the query is like this :-
((A AND B) NOT (C AND D) AND (E OR F) NOT (N AND M))

i want to separate the terms i.e

(A AND B) AND (E OR F) something like rearrangement without NOT terms.

and NOT terms in separate array.

finally my output:-
a)(A AND B) AND (E OR F)
b)(C AND D) NOT (N AND M)

more specifically NOT terms in one array and other terms in other array.
Sep 11 '07 #3
KevinADC
4,059 Recognized Expert Specialist
how do you know (A AND B) belongs in the AND group? There is no AND or NOT in front of it. Have you tried any code yet we can look at? (he asks for the second time).
Sep 11 '07 #4
numberwhun
3,509 Recognized Expert Moderator Specialist
basically the query is like this :-
((A AND B) NOT (C AND D) AND (E OR F) NOT (N AND M))

i want to separate the terms i.e

(A AND B) AND (E OR F) something like rearrangement without NOT terms.

and NOT terms in separate array.

finally my output:-
a)(A AND B) AND (E OR F)
b)(C AND D) NOT (N AND M)

more specifically NOT terms in one array and other terms in other array.
Archanak,

I have to agree with Kevin 100%. You really need to post the code that you have tried thus far so that we can help you troubleshoot it. We won't write your script, but will certainly troubleshoot it with you so you can learn.

Regards,

Jeff
Sep 11 '07 #5
Archanak
79 New Member
how do you know (A AND B) belongs in the AND group? There is no AND or NOT in front of it. Have you tried any code yet we can look at? (he asks for the second time).
Hi Kevin,

suppose my query is like this:-
((A AND B) NOT (C AND D) AND (M AND N) NOT (P OR Q))

i tried like this:-

Expand|Select|Wrap|Line Numbers
  1. if($query=~/(.*)\sNOT\s\(([^()]+)\)(.*)/g)
  2. {
  3.         $key=$1;
  4.         $sec=$2;
  5.         $third=$3;
  6.         print "<br>first =$key<br>";
  7.         print "<br>second=$sec<br>";
  8.         print "<br>third=$third<br>";
  9.         $final=$key."".$third;
  10.         print "<br>****final value=$final<br>";
  11.         if($final=~/(.*)\sNOT\s\(([^()]+)\)(.*)/)
  12.         {
  13.                 $term=$1;
  14.                 $sterm=$2;
  15.                 $lterm=$3;
  16.                 print "< br>TERM=**************$1**<br>";
  17.                 print "<br>STERM=******$2<br>";
  18.                 print "<br>LTERM=*****$3<br>";
  19.     }
  20. }
  21.  
i.e first i have used regular expression to filter NOT terms

i have stored the terms in $1, $2& $3
and check again if it has NOT terms then again store $1,$2....

But if many NOT terms this will not work.
Sep 11 '07 #6
numberwhun
3,509 Recognized Expert Moderator Specialist
Archanak,

I have edited your post and corrected it for top posting. Please do not put your replies above the quoted text, otherwise

flow.
natural
conversations
the
follow
easily
wont
we

Regards,

Jeff
Sep 11 '07 #7
KevinADC
4,059 Recognized Expert Specialist
Hi Kevin,

suppose my query is like this:-
((A AND B) NOT (C AND D) AND (M AND N) NOT (P OR Q))


But if many NOT terms this will not work.
You need to create a list of the pattern matches. Generally you can do that by returning the value of a regexp to an array and use the "g" option with your regexp.


@list = $foo =~ /(pattern)/g;
Sep 11 '07 #8
Archanak
79 New Member
You need to create a list of the pattern matches. Generally you can do that by returning the value of a regexp to an array and use the "g" option with your regexp.


@list = $foo =~ /(pattern)/g;
Hi kevin,

can u explain more about how to implement?

with regards
Sep 13 '07 #9
KevinADC
4,059 Recognized Expert Specialist
Expand|Select|Wrap|Line Numbers
  1. my $string = '((A AND B) NOT (C AND D) AND (E OR F) NOT (N AND M))';
  2. my @not = $string =~ /NOT (\(\w AND \w\))/g;
Sep 13 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
990
by: Karl Rhodes | last post by:
Ok, we think we have a problem which SHOULD be simple to resolve but appears to be impossible (unless we're not as good as we thought we were!!!) We have seperate workstations on which we do our development. We have a seperate server running IIS which hosts all our development websites. We have a seperate fileserver where all our source code is kept in a very neat file structure.
7
2558
by: Shannan Casteel via AccessMonster.com | last post by:
I have a form for entering part numbers along with the associated quantity for each part. There are 25 Part fields and 25 associated Quantity fields. If I go to record 1 and enter part number 1234 for part1, 3 for quantity1, and 1235 for part2, 8 for quantity2, and on record 2 I enter 1236 for part1, 2 for quantity1, and 1234 for part2, 2 for quantity2, how would I get Access to spit out a report that says something like this: Part...
9
1975
by: ern | last post by:
I'm using scanf("%s",userInput) to capture up to three words from the user. I want to seperate those three words into three variables: char * firstWord; char * secondWord; char * thirdWord; Is there an easy way/function that can do this already? Thanks!
8
3320
by: Serge | last post by:
Hi, I have some intensive code that is running on my main thread. I try to show a status update on a 'status form'. The problem that i have is that because it is running in the same thread the window is not responding to the user. The user is now able to minimize, move the window because the code is too busy on it's own work. (and they are all running on the same thread)
12
5848
by: Brian Keating EI9FXB | last post by:
Hello all, Wonder what approach is used for this problem. I have a MDIApplication, the MDIClinets are to be in a seperate thread. So I've done something like this, // Create a new Show method that starts a new thread public new void Show() { Thread t = new Thread(new ThreadStart(ThreadProc));
8
2978
by: feng | last post by:
In our VB.Net application, we need to be able to start another process (thread won't do it) and run some logic in it, and still be able to communicate with the main process. Is this possible and how to do it? Thanks
6
3176
by: Kyle Teague | last post by:
What would give better performance, serializing a multidimensional array and storing it in a single entry in a table or storing each element of the array in a separate table and associating the entries with the entry in the other table? Having a separate table would result in two queries instead of one, but you wouldn't have to deal with the overhead of serializing and unserializing data. -- Kyle
0
1244
by: bloukopkoggelmander | last post by:
Hi All wonderfull brains! Right I have two questions after my last very successfull thread. I have tried looking these up on the net, but no luck. Scenario 1 is : I have a bound form with bound controls. For one of the controls I look up the values from a table, but the values I then sleect from this combo box, is concatednated, ie. Lastname,Firstname,Employee number. Now what I want is that once the user has selected a concatenated name...
5
2146
by: cmrhema | last post by:
Hello I want to separate or say split a string. Eg. I have a word Client Server It should be split as Client Server I went and searched and got it string MainString = "String Manipulation";
2
2132
by: desertavataraz | last post by:
I am going write an application in C++ that allows the user to see two languages at once, and allows them to search each individual language for words or keywords. I have a font that I made specially for the non-English language, which would allow me to simply use different fonts for each specific language. I could also control how the search works simply by reading the font tags, for each language, so I only get results in that specific...
0
8620
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9181
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9040
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7756
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3060
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2353
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.