473,788 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compiled Regex in 1.1 & 2.0

Hi,
I had a problem with a rather complex regex expression that didn't return
the same results in 1.1 and 2.0. I first thought that I could make a
utility assambly that referenced the 1.1 version of mscorlib and the use
that from the 2.0 application. But that didn't work so I drew the
conclusion that the problem was the runtime. That was wrong. I've compiled
the regular expression in 1.1 into a physical assembly using
Regex.CompileTo Assembly and it works fine when referenced from the 2.0
application. The problem seems to be the actual parsing of the regular
expression in 2.0.

I don't know what goes wrong, but I now have a working workaround so I'll
let it drop. Now I'm just wondering if somebody at Microsoft would like to
pick it up to ferret out the possible cause.

Pattern (IgnorePatternW hitespace):
(?<list>
\[
(?>
([^[]|[]])+
|
\[ (?<DEPTH>)
|
\] (?<-DEPTH>)
)*
(?(DEPTH)(?!))
\]
)
|
(?<structure>
\w*\(
(?>
[^()]+
|
\( (?<DEPTH>)
|
\) (?<-DEPTH>)
)*
(?(DEPTH)(?!))
\)
)
|
('(?<quot>
[\w]*
)')
|
(?<variable>
[A-ZÅÄÖ]\w*
)
|
(?<value>
[a-zåäö]\w*
)

Input:
value,Var,[L1,L2,[L3,L4]],'Text',p(a,b)

Desired result (one row per match in Matches):
"value" in capture group 'value'
"Var" in capture group 'variable'
"[L1,L2,[L3,L4]]" in capture group 'list'
"'Text'" in capture group 'quot'
"p(a,b)" in capture group 'structure'

/Hugo
Nov 16 '05 #1
0 1067

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

Similar topics

1
5893
by: Shmulik | last post by:
How can I (can I?) use a regular expression as the filter to a FileSystemWatcher? I want to watch for something like this: Regex regex = new Regex(@"^Current(One|Two|Three)File\.txt$", RegexOptions.IgnoreCase); That is, is the file CurrentOneFile.txt, CurrentTwoFile.txt, etc. shows in in the directory I'm watching, then I can take action.
7
2619
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:
2
4285
by: John Grandy | last post by:
Is it advisable to compile a Regex for a massively scalable ASP.NET web-application ? How exactly does this work ? Do you create a separate class library and expose the Regex.Replace() as a method ..... ..... or can you just use the syntax :
20
8119
by: jeevankodali | last post by:
Hi I have an .Net application which processes thousands of Xml nodes each day and for each node I am using around 30-40 Regex matches to see if they satisfy some conditions are not. These Regex matches are called within a loop (like if or for). E.g. for(int i = 0; i < 10; i++) { Regex r = new Regex();
14
2262
by: ohmmega | last post by:
hy, i've got a simple question (for somebody who already knows the answer) about regex: i've a string like bla@bla@bla or bla@@bla i like to check the @'s, but couldn't figure it out how to set zero or more char's. (zero or one was easy). thank's rené
0
1173
by: Wilson799799 | last post by:
Hello, I am searching for a way to match quotation marks (extended ascii characters 147 and 148) with a .net regex. I tried this regex += .... |" + System.Convert.ToChar(147) + "|" + System.Convert.ToChar(148) + |\w+|)" but the convert yields an empty string. I cannot use the dot operator for this regex. Thank you.
3
1223
by: Svinja | last post by:
Hi, I want to replace "\n" with "!" in c#, i tried this: String buffer=richTextBox.Text; buffer=buffer.Replace(@"\n", "!"); and it worked, but this didnt: String buffer=richTextBox.Text; buffer = Regex.Replace(buffer, @"\n", "!");
7
174
by: CSharper | last post by:
I have a situation where I have file with all the find and replace values, I read it and put it in a dictionary format. Next I have to read all the files in a given directory and read each line in each file and apply regex on it. The way I am doing it is, not the real code but for an idea... foreach(file in directory) { filehandle = file.open(file) foreach(line in filehandle)
6
2074
by: | last post by:
Hi all, Sorry for the lengthy post but as I learned I should post concise-and-complete code. So the code belows shows that the execution of ValidateAddress consumes a lot of time. In the test it is called a 100 times but in my real app it could be called 50000 or more times. So my question is if it is somehow possible to speed this up and if so how
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
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,...
1
10110
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
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
7517
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
5398
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
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
2894
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.