473,769 Members | 5,570 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pcre.c : And Operator

Hi,
I'm using pcre.c to provide regex support for my application
software. I want to know how to do 'AND' operation in this. I didn't
got any useful info from the net.

Is this operator available or not? If not how could we do this
operation? Any stuffed replies or redirection will be appreciated.

Thanks,
Ganesh

Nov 14 '05 #1
17 2115
sg*******@yahoo .co.in wrote:
Hi,
I'm using pcre.c to provide regex support for my application
software. I want to know how to do 'AND' operation in this. I didn't
got any useful info from the net.

Is this operator available or not? If not how could we do this
operation? Any stuffed replies or redirection will be appreciated.

Thanks,
Ganesh


What on earth is an AND operator in a regular expression?

gtoomey
Nov 14 '05 #2
>> What on earth is an AND operator in a regular expression?

If you have an OR ( | ) operator, where is the ( & )

Nov 14 '05 #3
sg*******@yahoo .co.in wrote:
What on earth is an AND operator in a regular expression?


If you have an OR ( | ) operator, where is the ( & )


From http://www.perl.com/doc/manual/html/pod/perlre.html
| is alternation

ie [a|b|c]x will match ax or bx or cx

But there is no & as its meaningless. Suppose your could have [a&b&c]x . It
would need to ax and bx and cx simultaneously which is impossible. Its
meaningless.

gtoomey
Nov 14 '05 #4
>> would need to ax and bx and cx simultaneously which is
impossible. Its meaningless.


"match ax bx cx". I want to match ax,bx,cx in the string. How can I do
this then. If one of these there is not there then it should print
false.

-Ganesh

Nov 14 '05 #5
sg*******@yahoo .co.in scribbled the following:
would need to ax and bx and cx simultaneously which is
impossible. Its meaningless.
"match ax bx cx". I want to match ax,bx,cx in the string. How can I do
this then. If one of these there is not there then it should print
false.


What do you mean by "match ax bx cx" or "match ax,bx,cx"? What
*specific* criterion should the string match?
Do you mean any string that includes *all* of "ax", "bx" and "cx", not
just any one of them? If so, then one very awkward way would be
something like:
(*ax*bx*cx*)|(* ax*cx*bx*)|(*bx *ax*cx*)|(*bx*c x*ax*)|(*cx*ax* bx*)|
(*cx*bx*ax*)
I think there's a shorter way but I can't come up with one now. If
that's not what you want, then what is?

--
/-- Joona Palaste (pa*****@cc.hel sinki.fi) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"Shh! The maestro is decomposing!"
- Gary Larson
Nov 14 '05 #6
On Thu, 17 Feb 2005 01:53:22 -0800, sgane2001 wrote:
would need to ax and bx and cx simultaneously which is
impossible. Its meaningless.


"match ax bx cx". I want to match ax,bx,cx in the string. How can I do
this then. If one of these there is not there then it should print
false.


Regular expressions can't do that directly. The simplest way is probaby to
perform 3 separate searches.

Lawrence
Nov 14 '05 #7
some incidental interloper responded to someone who wrote:

[Regarding the '&' operator in regular expressions...]
would need to ax and bx and cx simultaneously which is
impossible. Its meaningless.


Forgive me for not responding to the orignal article,
my news server has lost track of it.

The '&' operator isn't meaningless, it means language
intersection. (At least, that's a reasonable guess.)

So, the expression

(a|b|c)&(c|d|e)

would be the same as the expression

c

or, for another example

[a-n]&[i-z]

would be the same as the expression

[i-n]

In these examples only letters are literal characters,
others are all meta-characters.

Can interested parties take this discussion to a newsgroup
more appropriate than comp.lang.c? Thank you.
Nov 14 '05 #8
Lawrence Kirby wrote:
On Thu, 17 Feb 2005 01:53:22 -0800, sgane2001 wrote:

.... snip ...

"match ax bx cx". I want to match ax,bx,cx in the string. How
can I do this then. If one of these there is not there then it
should print false.


Regular expressions can't do that directly. The simplest way is
probaby to perform 3 separate searches.


Factor it. [a|b|c]x

--
"If you want to post a followup via groups.google.c om, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson

Nov 14 '05 #9
Factor it. [a|b|c]x


What I want is, match all the patterns in the given string. I knew that
we can match all the patterns if they are given in order of occurance.
But how to do that in case of un-ordered patterns.

Ex: String ---> "Match the occurances of "match", "this" in this
string"

String =~ /'this' & 'match'/ . How can I do this?

Nov 14 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2000
by: news | last post by:
Hi all, I am a beginner on 'c' and pcre...and I am on windows 2000 and VC6 with all of the patches, etc. The following program leaks lots of memory and I only make 1 pcre call. I read the docs, but maybe I missed some cleanup or other calls??? Or maybe I messed up passing strings around???
2
3924
by: Bernd Muent | last post by:
Hi together, most of the time I'm using .net framework to programm C++. F.E. I can do the following: Regex* rex; String* replacedTags=rex->Replace(originalLine,S"<(.*)?>,S"<SPECIAL>$1</SPECIAL>"); For a special program I would like to do the same in a standard C++ program. I found the library pcre and after some starting problems I'm able to
16
3180
by: mainland | last post by:
I use prce to match string. I define a pcre struct point, then compile, pass pcre struct point to 'pcre_compile'. When complete, Is it necessary to use 'pcre_free' to free pcre struct point. example: .......
2
5719
by: Serman D. | last post by:
Hi all, I'm trying to complete the samples from the excellent 2003 developerWorks article "Bringing the Power of Regular Expression Matching to SQL" by Knut Stolze: http://tinyurl.com/3bhrnn I've managed to compile and link the C code from "Listing 5", the regexpSimple() wrapper (see link). The build options are pretty much
13
7492
by: Wiseman | last post by:
I'm kind of disappointed with the re regular expressions module. In particular, the lack of support for recursion ( (?R) or (?n) ) is a major drawback to me. There are so many great things that can be accomplished with regular expressions this way, such as validating a mathematical expression or parsing a language with nested parens, quoting or expressions. Another feature I'm missing is once-only subpatterns and possessive quantifiers...
1
2452
by: moreati | last post by:
Recently I discovered the re module doesn't support POSIX character classes: Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) on linux2 Type "help", "copyright", "credits" or "license" for more information. None So I thought I'd try out pcre through ctypes, to recreate pcredemo.c in python. The c code is at:
8
1929
by: redbeardmcg | last post by:
Hi everyone, I'm having an issue splitting a string with preg_split.... Here is a sample string: congestion >= 80 Where >= could also be <=, ==, !=, < or > What I need to accomplish is splitting this, and put each of the three parts (item, operator, value) into an array.... Here is how I'm doing this:
0
10219
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
10049
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
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
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
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
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
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3967
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
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.