473,545 Members | 2,679 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help me with REGEXP please !

B.
Hello, I've got the following problem: Suppose you have the strings
contains:

"xxxx aaa { 111, 222, 333} bbb {111, 222,333} yyyy"
"xxxx aaa {1112, 2223, 3334} bbb {11112, 22223,33334,444 45} yyyy"
I need to select only those strings which match the sequence aaa {...}
with number 222 inside brackets. Number 222 can be of course at any
position inside brackets e.g. aaa {222, 333, 111}, or aaa
{111,333,222}.
How to do this with REGEXP ? Something like this:

1. find aaa
2. skip zero or more white chars until '{'
3. find sequence: "222 , ... }" or " ..., 222 , ...}" or "..., 222 }"

thanks for the help.
B.Sveton
Jul 20 '05 #1
8 1582
"B." <bo****@yahoo.c om> wrote in message
"xxxx aaa { 111, 222, 333} bbb {111, 222,333} yyyy"
"xxxx aaa {1112, 2223, 3334} bbb {11112, 22223,33334,444 45} yyyy"
I need to select only those strings which match the sequence aaa {...}
with number 222 inside brackets. Number 222 can be of course at any
position inside brackets e.g. aaa {222, 333, 111}, or aaa
{111,333,222}.
How to do this with REGEXP ? Something like this:


Didn't try it, but this might work for the regular expression:

..*aaa {.*222.*}.*
Jul 20 '05 #2
"B." <bo****@yahoo.c om> wrote in message
"xxxx aaa { 111, 222, 333} bbb {111, 222,333} yyyy"
"xxxx aaa {1112, 2223, 3334} bbb {11112, 22223,33334,444 45} yyyy"
I need to select only those strings which match the sequence aaa {...}
with number 222 inside brackets. Number 222 can be of course at any
position inside brackets e.g. aaa {222, 333, 111}, or aaa
{111,333,222}.
How to do this with REGEXP ? Something like this:


Didn't try it, but this might work for the regular expression:

..*aaa {.*222.*}.*
Jul 20 '05 #3
B.
"Siemel Naran" <Si*********@RE MOVE.att.net> wrote in message news:<lf******* **************@ bgtnsc05-news.ops.worldn et.att.net>...
"B." <bo****@yahoo.c om> wrote in message
"xxxx aaa { 111, 222, 333} bbb {111, 222,333} yyyy"
"xxxx aaa {1112, 2223, 3334} bbb {11112, 22223,33334,444 45} yyyy"
I need to select only those strings which match the sequence aaa {...}
with number 222 inside brackets. Number 222 can be of course at any
position inside brackets e.g. aaa {222, 333, 111}, or aaa
{111,333,222}.
How to do this with REGEXP ? Something like this:


Didn't try it, but this might work for the regular expression:

.*aaa {.*222.*}.*


I don't think so. It finds also aaa {111, 2222, 333} and 2222 != 222 :-(

B.
Jul 20 '05 #4
B.
"Siemel Naran" <Si*********@RE MOVE.att.net> wrote in message news:<lf******* **************@ bgtnsc05-news.ops.worldn et.att.net>...
"B." <bo****@yahoo.c om> wrote in message
"xxxx aaa { 111, 222, 333} bbb {111, 222,333} yyyy"
"xxxx aaa {1112, 2223, 3334} bbb {11112, 22223,33334,444 45} yyyy"
I need to select only those strings which match the sequence aaa {...}
with number 222 inside brackets. Number 222 can be of course at any
position inside brackets e.g. aaa {222, 333, 111}, or aaa
{111,333,222}.
How to do this with REGEXP ? Something like this:


Didn't try it, but this might work for the regular expression:

.*aaa {.*222.*}.*


I don't think so. It finds also aaa {111, 2222, 333} and 2222 != 222 :-(

B.
Jul 20 '05 #5
"B." <bo****@yahoo.c om> wrote in message
"Siemel Naran" <Si*********@RE MOVE.att.net> wrote in message

news:<lfOnc.397 25
Didn't try it, but this might work for the regular expression:

.*aaa {.*222.*}.*


I don't think so. It finds also aaa {111, 2222, 333} and 2222 != 222 :-(


OK. Maybe the beginning and end of word markers might help

..*aaa {.*[[:<:]]222[[:>:]].*}.*

Also, I don't think we need the leading and trailing .*, as that's
automatic, so

aaa {.*[[:<:]]222[[:>:]].*}

Now is { or } a special character too?
Jul 20 '05 #6
B.
"Siemel Naran" <Si*********@RE MOVE.att.net> wrote in message news:<%E******* **************@ bgtnsc05-news.ops.worldn et.att.net>...
"B." <bo****@yahoo.c om> wrote in message
"Siemel Naran" <Si*********@RE MOVE.att.net> wrote in message news:<lfOnc.397 25
Didn't try it, but this might work for the regular expression:

.*aaa {.*222.*}.*


I don't think so. It finds also aaa {111, 2222, 333} and 2222 != 222 :-(


OK. Maybe the beginning and end of word markers might help

.*aaa {.*[[:<:]]222[[:>:]].*}.*

Also, I don't think we need the leading and trailing .*, as that's
automatic, so

aaa {.*[[:<:]]222[[:>:]].*}

don't work at all :-( the expression also finds
"aaa {111, 333, 444} bbb {111,222,333}" because .* at the end skips
any number of chars which is always true, but i need to limit search
only between {} brackets. i can of course replace {} chars with
anything else, e.g. quotes, or double quotes, or () brackets, but the
search must be always limited between those chars. thanks once again
for the help.

B.


Now is { or } a special character too?

Jul 20 '05 #7
"B." <bo****@yahoo.c om> wrote in message > "Siemel Naran"
<Si*********@RE MOVE.att.net
aaa {.*[[:<:]]222[[:>:]].*}
don't work at all :-( the expression also finds
"aaa {111, 333, 444} bbb {111,222,333}" because .* at the end skips


Oops, I thought that's what you wanted as the 222 is within brackets. But
it has to be between the brackets right after the aaa. If so I think you
should replace any numbers of characters .* with any number of characters
that are not braces.

aaa {[^}]*[[:<:]]222[[:>:]][^{]*}

This means aaa, followed by space, followed by {, followed by any number of
chars that are not the close brace }, followed by 222 as a single word, etc.
The one thing to wonder about is what is the definition of a word.

any number of chars which is always true, but i need to limit search
only between {} brackets. i can of course replace {} chars with
anything else, e.g. quotes, or double quotes, or () brackets, but the
search must be always limited between those chars. thanks once again
for the help.

B.


Now is { or } a special character too?

Jul 20 '05 #8
B.
"Siemel Naran" <Si*********@RE MOVE.att.net> wrote in message news:<q2******* **************@ bgtnsc05-news.ops.worldn et.att.net>...
"B." <bo****@yahoo.c om> wrote in message > "Siemel Naran"
<Si*********@RE MOVE.att.net
aaa {.*[[:<:]]222[[:>:]].*}


don't work at all :-( the expression also finds
"aaa {111, 333, 444} bbb {111,222,333}" because .* at the end skips


Oops, I thought that's what you wanted as the 222 is within brackets. But
it has to be between the brackets right after the aaa. If so I think you
should replace any numbers of characters .* with any number of characters
that are not braces.

aaa {[^}]*[[:<:]]222[[:>:]][^{]*}

This means aaa, followed by space, followed by {, followed by any number of
chars that are not the close brace }, followed by 222 as a single word, etc.
The one thing to wonder about is what is the definition of a word.

any number of chars which is always true, but i need to limit search
only between {} brackets. i can of course replace {} chars with
anything else, e.g. quotes, or double quotes, or () brackets, but the
search must be always limited between those chars. thanks once again
for the help.

B.


Now is { or } a special character too?


yes, it works :-) many thanks.

B>
Jul 20 '05 #9

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

Similar topics

5
1214
by: Felix Collins | last post by:
Hi, I'm not a regexp expert and had a bit of trouble with the following search. I have an "outline number" system like 1 1.2 1.2.3 1.3
4
1457
by: Joseph | last post by:
The idea is to show only one of the <Baby_Div> while hiding all the others. At the moment all I have managed to do is to show each <Baby_Div> in turn as expected, but the problem is that once a <Baby_Div>.innerHTML is replaced by one of the procedures, it does not work anymore, ie, the <Baby_Div> content is not displayed anymore, once code...
21
3964
by: google | last post by:
I'm trying to implement something that would speed up data entry. I'd like to be able to take a string, and increment ONLY the right-most numerical characters by one. The type structure of the data that is in this field can vary. It's a list of mechanical equipment, and how it is designated varies based on how the customer has them labeled....
32
14630
by: Licheng Fang | last post by:
Basically, the problem is this: 'do' Python's NFA regexp engine trys only the first option, and happily rests on that. There's another example: 'oneself' The Python regular expression engine doesn't exaust all the
23
2852
by: codefire | last post by:
Hi, I am trying to get a regexp to validate email addresses but can't get it quite right. The problem is I can't quite find the regexp to deal with ignoring the case james..kirk@fred.com, which is not valid. Here's my attempt, neither of my regexps work quite how I want: import os import re
7
1712
by: VUNETdotUS | last post by:
How can I get the text after matching string is found: var str = "1111>AAAA<2222>BBBB<3333>CCCC"; if(str.indexOf("2222>")){ //how to get "BBBB" value following my "2222>" but before "<3333" or any < sign? }
8
1445
by: Tim Nash (aka TMN) | last post by:
Hi Can anyone help me match this div below - my regex does not work - if you could tell me why I would appreciate it. var aStr = "<div class='feedflare'>dfgdg dg</div>"; var reg = new RegExp("<div class='feedflare'.*?</div>'","gim"); thanks
4
1329
by: Andrew Poulos | last post by:
I have a string that looks like this "cmi.interactions.fred.id" I need to test that: - the first part of the string is "cmi.interactions." (case sensitive). - the last part of the string is ".id" (case sensitive). - that there's 1 or more characters between the 2nd and third dots (in the above example its "fred") - that there's only 3...
5
4910
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums there are, it crashes. There are currently 6 columns, and I only want 4. How do I remove the last two (discount and date)? Here is a link:...
0
7428
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...
0
7685
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. ...
0
7941
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...
1
7452
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6014
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...
1
5354
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...
0
3467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1916
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
1
1039
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.