Search:
Namespaces
Discussions
.NET v1.1
Feedback
RegEx gurus..
Messages
Related Types
This message was discovered on
ASPFriends.com 'aspngregexp' list
.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
dave wanta (VIP)
-- Moved from [aspngfreeforall] to [aspngregexp] by Alex Lowe <
Click here to reveal e-mail address
> --
Hi All,
I've got to do some parsing, of a LARGE html page. Inside of that page is a
bunch of javascript populating an array like:
Product0[0] = "Long Sleeve Shirts\",\"lsShirt";
Product0[1] = "Short Sleeve Shirts\",\"ssShirt";
Product0[2] = "Women's Pants\",\"wPants";
Product0[3] = "Men's Pants\",\"mPants";
Product0[4] = "Baseball Hats\",\"bbHats";
Product0[5] = "NFL Hats\",\"nflHats";
Where each array element is "ProductName,ProductCode"
What would be there RegEx to grab the ProductName and the Code?
Thanks,
dave
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.123aspx.com
The Largest ASP.NET Web Directory!
Find the latest ASP.NET resources --
Subscribe to our newsletter!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reply to this message...
Wayne King
This pattern should do it:
^\w* Product0.+? " (?<ProductName>[^\\]*?) \\",\\" =
(?<ProductCode>[^"]*)
It does not pick up the double-quote character after the ProductName or =
before the ProductCode.
It will fail if the ProductName contains an embedded backslash. Or, if =
ProductCode contains an embedded double-quote.
Whitespace is included in the pattern for readability.
-Wayne King
This posting is provided "AS IS" with no warranties, and confers no =
rights.
-----Original Message-----
From: dave wanta [mailto:
Click here to reveal e-mail address
]
Sent: Thursday, February 07, 2002 5:49 AM
To: aspngregexp
Subject: [aspngregexp] RegEx gurus..
-- Moved from [aspngfreeforall] to [aspngregexp] by Alex Lowe =
<
Click here to reveal e-mail address
> --
Hi All,
I've got to do some parsing, of a LARGE html page. Inside of that page =
is a
bunch of javascript populating an array like:
Product0[0] =3D "Long Sleeve Shirts\",\"lsShirt";
Product0[1] =3D "Short Sleeve Shirts\",\"ssShirt";
Product0[2] =3D "Women's Pants\",\"wPants";
Product0[3] =3D "Men's Pants\",\"mPants";
Product0[4] =3D "Baseball Hats\",\"bbHats";
Product0[5] =3D "NFL Hats\",\"nflHats";
Where each array element is "ProductName,ProductCode"
What would be there RegEx to grab the ProductName and the Code?
Thanks,
dave
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.123aspx.com
The Largest ASP.NET Web Directory!
Find the latest ASP.NET resources --
Subscribe to our newsletter!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| [aspngregexp] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/asplists/aspngregexp.asp
=3D JOIN/QUIT
|
http://www.asplists.com/search
=3D SEARCH Archives
Reply to this message...
Little, Ambrose
Wayne et al,
Could you recommend a good introduction to RegEx? I've tried looking a bit
at the MS docs (this was a year or so ago), and it didn't really click. I'm
looking for something that starts very basic, explaining the concepts, etc.
Thanks.
--Ambrose
[Original message clipped]
Reply to this message...
Wayne King
Jeffrey E. F. Friedl has written an excellent book about regular =
expressions. I highly recommend it. Great stuff!
Mastering Regular Expressions
by Jeffrey E. F. Friedl
ISBN: 1-56592-257-3
My copy is copyright 1997, printed in 1998. I don't know if there is a =
second edition, yet.
The .NET Framework Regular Expression Engine includes a few new features =
that are not covered by the book. I don't know of any good books or docs =
that thoroughly explain these advanced new features. But Friedl's book =
gives you the understanding and background to be able to make sense of =
the new features -- that is, if you find yourself in need of them.
-Wayne
-----Original Message-----
From: Little, Ambrose [mailto:
Click here to reveal e-mail address
]
Sent: Friday, February 08, 2002 12:35 PM
To: aspngregexp
Subject: [aspngregexp] RE: RegEx gurus..
Wayne et al,
Could you recommend a good introduction to RegEx? I've tried looking a =
bit
at the MS docs (this was a year or so ago), and it didn't really click. =
I'm
looking for something that starts very basic, explaining the concepts, =
etc.
Thanks.
--Ambrose
[Original message clipped]
| [aspngregexp] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/asplists/aspngregexp.asp
=3D JOIN/QUIT
|
http://www.asplists.com/search
=3D SEARCH Archives
Reply to this message...
Little, Ambrose
Wayne,
I looked this book up, and the subtitle is "Powerful Techniques for Perl and
Other Tools." For someone who is totally unfamiliar with Perl (i.e., ME),
would I have problems with this book? Does it require Perl knowledge?
Thanks.
--Ambrose
[Original message clipped]
Reply to this message...
Wayne King
No knowledge of Perl is needed - I've never used Perl, either. Perl has =
an advanced regex engine, and Mr. Friedl devotes a good chunk of the =
book delving into how those features work in the context of Perl. =
Concerning that chapter, he says, "... I assume you have at least a =
basic familiarity with Perl. (If you've read Chapter 2, you're probably =
already familiar enough to at least start using this chapter.)"
The last one-third or so of the book deals with tool-specific regex =
details. I read the first two-thirds of the book in detail, then =
lightened up a bit on the latter, tool-specific chapters. I think one of =
the main ideas of the book is that once you understand regexes, how they =
work, and the different types of engines, it doesn't matter which =
particular implementation or language you are using.
-----Original Message-----
From: Little, Ambrose [mailto:
Click here to reveal e-mail address
]
Sent: Monday, February 11, 2002 11:33 AM
To: aspngregexp
Subject: [aspngregexp] RE: RegEx gurus..
Wayne,
I looked this book up, and the subtitle is "Powerful Techniques for Perl =
and
Other Tools." For someone who is totally unfamiliar with Perl (i.e., =
ME),
would I have problems with this book? Does it require Perl knowledge?
Thanks.
--Ambrose
[Original message clipped]
| [aspngregexp] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/asplists/aspngregexp.asp
=3D JOIN/QUIT
|
http://www.asplists.com/search
=3D SEARCH Archives
Reply to this message...
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com