473,466 Members | 1,508 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

lost in regular expression

I'm trying to parse the title and url out of a bunch of menu javascript
statements to convert a Macromedia menu to ASP.NET menu control.

The line I'm searching is of the form:
mm_menu_1222090555_0.addMenuItem("MyTitle","window .open('MyURL.htm',
'_self');");

The regex I came up (which doesn't match) is:
r = new Regex(@"addMenuItem.""(?<1>.#)"".*window.open.'(?< 2>.#)'"

Thanks for any help with this
Aug 26 '06 #1
4 1303
I figured it out, I was getting confused between industry standard Regex
quantifiers and MS proprietary versions

e.g. for minimal match I was using .# whereas MS uses .*?

"Dabbler" wrote:
I'm trying to parse the title and url out of a bunch of menu javascript
statements to convert a Macromedia menu to ASP.NET menu control.

The line I'm searching is of the form:
mm_menu_1222090555_0.addMenuItem("MyTitle","window .open('MyURL.htm',
'_self');");

The regex I came up (which doesn't match) is:
r = new Regex(@"addMenuItem.""(?<1>.#)"".*window.open.'(?< 2>.#)'"

Thanks for any help with this
Aug 26 '06 #2
Dabbler wrote:
I figured it out, I was getting confused between industry standard
Regex quantifiers and MS proprietary versions

e.g. for minimal match I was using .# whereas MS uses .*?
..*? is the industry standard (and ECMA standard) way of specifying minimal
match, AFIAK. Where have you seen a regex that uses .# ?

-cd
Aug 26 '06 #3
You're right Carl, I stand corrected. I've been using Regular Expressions in
editors to modify text so much I didn't realize that's where I got my
"industry standard" view. And to make matters worse it's MS that is using
different syntax in their VS IDE vs the Regex library in C#. For instance .#
is used for minimal matching in IDE vs .+? in Regex library.VS IDE uses {} to
tag expressions compared to () in the library. That's where my confusion came
from.

Thanks for clearing that up.

"Carl Daniel [VC++ MVP]" wrote:
Dabbler wrote:
I figured it out, I was getting confused between industry standard
Regex quantifiers and MS proprietary versions

e.g. for minimal match I was using .# whereas MS uses .*?

..*? is the industry standard (and ECMA standard) way of specifying minimal
match, AFIAK. Where have you seen a regex that uses .# ?

-cd
Aug 26 '06 #4
Dabbler wrote:
You're right Carl, I stand corrected. I've been using Regular
Expressions in editors to modify text so much I didn't realize that's
where I got my "industry standard" view. And to make matters worse
it's MS that is using different syntax in their VS IDE vs the Regex
library in C#. For instance .# is used for minimal matching in IDE vs
.+? in Regex library.VS IDE uses {} to tag expressions compared to ()
in the library. That's where my confusion came from.

Thanks for clearing that up.
No problem.

The whacky idea that the VS IDE has of regular expressions drives me up a
wall! Here they've got this lovely, ECMA-compliant regex library in .NET,
and VS uses it's own, one of a kind, proprietary flavor of regex. Go
figure.

-cd
Aug 26 '06 #5

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

Similar topics

1
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
4
by: Buddy | last post by:
Can someone please show me how to create a regular expression to do the following My text is set to MyColumn{1, 100} Test I want a regular expression that sets the text to the following...
4
by: Neri | last post by:
Some document processing program I write has to deal with documents that have headers and footers that are unnecessary for the main processing part. Therefore, I'm using a regular expression to go...
11
by: Dimitris Georgakopuolos | last post by:
Hello, I have a text file that I load up to a string. The text includes certain expression like {firstName} or {userName} that I want to match and then replace with a new expression. However,...
3
by: James D. Marshall | last post by:
The issue at hand, I believe is my comprehension of using regular expression, specially to assist in replacing the expression with other text. using regular expression (\s*) my understanding is...
7
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I...
25
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
4
by: Jon Paal | last post by:
when user loses their password, the membership module emails a new password , the format is very complex. how can I set the format to be simple alphanumeric - say 7 characters long ?
1
by: Allan Ebdrup | last post by:
I have a dynamic list of regular expressions, the expressions don't change very often but they can change. And I have a single string that I want to match the regular expressions against and find...
1
by: NvrBst | last post by:
I want to use the .replace() method with the regular expression /^ %VAR % =,($|&)/. The following DOESN'T replace the "^default.aspx=,($|&)" regular expression with "":...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
1
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...
0
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...
0
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,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.