473,549 Members | 2,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Another one for the regex gurus


Hi Dave -

Thanks, I'll give an easier example, say I have:

sodium ion test

and I search for "sodium ion test", matching, tagging, I end up with, say

TEST${sodium ion test}

now if I go to search for just "ion", i don't want it to match because "ion"
is now within curly braces.

using [^{].+ion.+[^}] produces a match, which i don't want. If i put spaces
in the regex like so, [^{] .+ ion .+ [^}], then it doesn't match, but also
doesn't match simply "sodium ion test"

Basically, if I'm searching for "ion" here's the truth table I want to end
up with:

string match?
TEST${sodium ion test} no
sodium ion test yes
TEST${sodium} ion test yes
TEST${sodium} ion TEST${test} yes

Again, thanks in advance for any suggestions!

Derrick
-----------------------------------------------------------------------

Your example seems fine. Is there a reason it's not working for you? What
is the side effect?

--
Dave Sexton
dave@www..jwaon line..com
-----------------------------------------------------------------------
"Derrick" <de*********@ex cite.com> wrote in message
news:eM******** ******@TK2MSFTN GP15.phx.gbl...
I am attempting to perform some word/phrase tagging, using regular
expressions.

I have the simple case working, looking for the string "one two three" in
the string "one two three four three two one"

My code is then tagging the match and surrounding it with braces, so I would end up with

"$MATCH1{on e two three} four three two one"

Down the line I wind up searching for the single word, "two", but do not
want to match the first occurence which is enclosed within curly braces.

Can anyone help me with the expression to match the second "two" in the
above string, but not the first, which is enclosed within curly braces, but does not necessarily have the enclosing curly braces right next to the
string you are searching for?

The farthest I could get was something along the lines of

[^{] .+ two .+ [^}]

?

Thanks a bunch in advance!

Derrick

Nov 17 '05 #1
0 1038

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

Similar topics

5
2128
by: Ali Eghtebas | last post by:
Hi, I've made this regex to catch the start of a valid multiline comment such as "/*" in e.g. T-SQL code. "(?<=^(?:*'*')*?*)(?<!^(?:*'*')*?--.*)/\*.*?$" With Multiline option on. As we know the T-SQL single line comment starts with a "--" and the string character is a "'". Considering all this, from these lines below the pattern will...
7
2600
by: bill tie | last post by:
I'd appreciate it if you could advise. 1. How do I replace "\" (backslash) with anything? 2. Suppose I want to replace (a) every occurrence of characters "a", "b", "c", "d" with "x", (b) every occurrence of characters "p", "q", "r", "s" with "y". Right now, I do it as follows:
0
1004
by: Ali Eghtebas | last post by:
Hi, I've made this regex to catch the start of a valid multiline comment such as "/*" in e.g. T-SQL code. "(?<=^(?:*'*')*?*)(?<!^(?:*'*')*?--.*)/\*.*?$" With Multiline option on. As we know the T-SQL single line comment starts with a "--" and the string character is a "'". Considering all this, from these lines below the pattern will...
4
252
by: Ali Eghtebas | last post by:
Hi, I've made this regex to catch the start of a valid multiline comment such as "/*" in e.g. T-SQL code. "(?<=^(?:*'*')*?*)(?<!^(?:*'*')*?--.*)/\*.*?$" With Multiline option on. As we know the T-SQL single line comment starts with a "--" and the string character is a "'". Considering all this, from these lines below the pattern will...
0
7956
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
7469
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
7808
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...
1
5368
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
5087
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...
0
3498
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...
1
1935
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
1057
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
757
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...

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.