Could someone please explain to me what the (?<Key> and (?<Value>
are in the following Regex expression?
This gets relative links in an HTML string (file).
"(?<Key>href=[""'](?!#|http|ftp|mailto|javascript)(?<Value>[^""']*)
[""'])"
Here is usage:
reg = New Regex( _
"(?<Key>href=[""'](?!#|http|ftp|mailto|javascript)(?<Value>
[^""']*)[""'])", _
RegexOptions.IgnoreCase _
Or RegexOptions.Multiline _
Or RegexOptions.Compiled)
What would that be as a standard Regex expression, for Perl or any other
regex engine? 13 1537
mrclean,
They are named groups, they would (should) be the same in Perl & other regex
engines.
A tutorial & reference on using regular expressions: http://www.regular-expressions.info/
The MSDN's documentation on regular expressions: http://msdn.microsoft.com/library/de...geElements.asp
Both of the above sites provide information on named groups.
Hope this helps
Jay
"The Cleaning Wonder Boy" <mr*****@baldy.com> wrote in message
news:MP************************@msnews.microsoft.c om... Could someone please explain to me what the (?<Key> and (?<Value> are in the following Regex expression?
This gets relative links in an HTML string (file).
"(?<Key>href=[""'](?!#|http|ftp|mailto|javascript)(?<Value>[^""']*) [""'])"
Here is usage:
reg = New Regex( _ "(?<Key>href=[""'](?!#|http|ftp|mailto|javascript)(?<Value> [^""']*)[""'])", _ RegexOptions.IgnoreCase _ Or RegexOptions.Multiline _ Or RegexOptions.Compiled)
What would that be as a standard Regex expression, for Perl or any other regex engine?
mrclean,
They are named groups, they would (should) be the same in Perl & other regex
engines.
A tutorial & reference on using regular expressions: http://www.regular-expressions.info/
The MSDN's documentation on regular expressions: http://msdn.microsoft.com/library/de...geElements.asp
Both of the above sites provide information on named groups.
Hope this helps
Jay
"The Cleaning Wonder Boy" <mr*****@baldy.com> wrote in message
news:MP************************@msnews.microsoft.c om... Could someone please explain to me what the (?<Key> and (?<Value> are in the following Regex expression?
This gets relative links in an HTML string (file).
"(?<Key>href=[""'](?!#|http|ftp|mailto|javascript)(?<Value>[^""']*) [""'])"
Here is usage:
reg = New Regex( _ "(?<Key>href=[""'](?!#|http|ftp|mailto|javascript)(?<Value> [^""']*)[""'])", _ RegexOptions.IgnoreCase _ Or RegexOptions.Multiline _ Or RegexOptions.Compiled)
What would that be as a standard Regex expression, for Perl or any other regex engine?
mrclean, Nothing on this site about it..
You missed the first item on this page: http://www.regular-expressions.info/refext.html
Not much help with no examples...
Do you want samples of the regex or samples of how to access them from your
code. The msdn page gives examples of the RegEx itself. Your question only
asked what they were, not how to use them. I will look later for some
samples, in the mean time, check out the classes in the
System.Text.RegularExpressions namespace, I would start with Groups, as the
tags you were asking about are named groups...
Not really as helpful as I would like...
How does that saying go: If you give a man a fish, he eats for a day, if you
teach a man to fish he eats for life...
Hope this helps
Jay
"The Cleaning Wonder Boy" <mr*****@baldy.com> wrote in message
news:MP************************@msnews.microsoft.c om... In article <O0**************@TK2MSFTNGP12.phx.gbl>, Ja************@msn.com says... mrclean, They are named groups, they would (should) be the same in Perl & other regex engines.
A tutorial & reference on using regular expressions: http://www.regular-expressions.info/
Nothing on this site about it..
The MSDN's documentation on regular expressions: http://msdn.microsoft.com/library/de...geElements.asp
Not much help with no examples...
Both of the above sites provide information on named groups.
Hope this helps
Not really as helpful as I would like...
mrclean, Nothing on this site about it..
You missed the first item on this page: http://www.regular-expressions.info/refext.html
Not much help with no examples...
Do you want samples of the regex or samples of how to access them from your
code. The msdn page gives examples of the RegEx itself. Your question only
asked what they were, not how to use them. I will look later for some
samples, in the mean time, check out the classes in the
System.Text.RegularExpressions namespace, I would start with Groups, as the
tags you were asking about are named groups...
Not really as helpful as I would like...
How does that saying go: If you give a man a fish, he eats for a day, if you
teach a man to fish he eats for life...
Hope this helps
Jay
"The Cleaning Wonder Boy" <mr*****@baldy.com> wrote in message
news:MP************************@msnews.microsoft.c om... In article <O0**************@TK2MSFTNGP12.phx.gbl>, Ja************@msn.com says... mrclean, They are named groups, they would (should) be the same in Perl & other regex engines.
A tutorial & reference on using regular expressions: http://www.regular-expressions.info/
Nothing on this site about it..
The MSDN's documentation on regular expressions: http://msdn.microsoft.com/library/de...geElements.asp
Not much help with no examples...
Both of the above sites provide information on named groups.
Hope this helps
Not really as helpful as I would like...
mrclean,
Here is an series of articles on how to use the
System.Text.RegularExpressions.Regex class in your code. http://msdn.microsoft.com/library/de...xpressions.asp
The samples include using named groups.
Hope this helps
Jay
"The Cleaning Wonder Boy" <mr*****@baldy.com> wrote in message
news:MP************************@msnews.microsoft.c om... In article <O0**************@TK2MSFTNGP12.phx.gbl>, Ja************@msn.com says... mrclean, They are named groups, they would (should) be the same in Perl & other regex engines.
A tutorial & reference on using regular expressions: http://www.regular-expressions.info/
Nothing on this site about it..
The MSDN's documentation on regular expressions: http://msdn.microsoft.com/library/de...geElements.asp
Not much help with no examples...
Both of the above sites provide information on named groups.
Hope this helps
Not really as helpful as I would like...
mrclean,
Here is an series of articles on how to use the
System.Text.RegularExpressions.Regex class in your code. http://msdn.microsoft.com/library/de...xpressions.asp
The samples include using named groups.
Hope this helps
Jay
"The Cleaning Wonder Boy" <mr*****@baldy.com> wrote in message
news:MP************************@msnews.microsoft.c om... In article <O0**************@TK2MSFTNGP12.phx.gbl>, Ja************@msn.com says... mrclean, They are named groups, they would (should) be the same in Perl & other regex engines.
A tutorial & reference on using regular expressions: http://www.regular-expressions.info/
Nothing on this site about it..
The MSDN's documentation on regular expressions: http://msdn.microsoft.com/library/de...geElements.asp
Not much help with no examples...
Both of the above sites provide information on named groups.
Hope this helps
Not really as helpful as I would like...
In article <eR**************@tk2msftngp13.phx.gbl>, Ja************@msn.com says... mrclean, Nothing on this site about it..
You missed the first item on this page:
http://www.regular-expressions.info/refext.html
It wasn't very clear what that page is to someone who doesn't know what
groupings are and the expression I posted had groupings.
<SNIP> Not really as helpful as I would like... How does that saying go: If you give a man a fish, he eats for a day, if you teach a man to fish he eats for life...
Well knowing nothing about regexes, it would have been better to explain
the expression instead. I have no idea how the expression works on my
text. It is supposed to get relative hrefs from HTML. Using the same
expression in a grep tool that I have that supports regex reveals no
results. Must be that it is a .Net expression (from some VB.Net code).
What would this be for a PCRE cpable tool?
<SNIP> They are named groups, they would (should) be the same in Perl & other regex engines.
From what I read on the aforementioned site, .Net Regex grouping is NOT
the same as in Perl or Python.
In article <eR**************@tk2msftngp13.phx.gbl>, Ja************@msn.com says... mrclean, Nothing on this site about it..
You missed the first item on this page:
http://www.regular-expressions.info/refext.html
It wasn't very clear what that page is to someone who doesn't know what
groupings are and the expression I posted had groupings.
<SNIP> Not really as helpful as I would like... How does that saying go: If you give a man a fish, he eats for a day, if you teach a man to fish he eats for life...
Well knowing nothing about regexes, it would have been better to explain
the expression instead. I have no idea how the expression works on my
text. It is supposed to get relative hrefs from HTML. Using the same
expression in a grep tool that I have that supports regex reveals no
results. Must be that it is a .Net expression (from some VB.Net code).
What would this be for a PCRE cpable tool?
<SNIP> They are named groups, they would (should) be the same in Perl & other regex engines.
From what I read on the aforementioned site, .Net Regex grouping is NOT
the same as in Perl or Python.
In article <u2**************@TK2MSFTNGP10.phx.gbl>, Ja************@msn.com says... mrclean, Here is an series of articles on how to use the System.Text.RegularExpressions.Regex class in your code.
<SNIP>
I ALREADY have VB.net code so I don't need to know how
to use it in my class, I'm trying to conmvert it to a PCRE
expression since .Net regex is NOT the same.
In article <u2**************@TK2MSFTNGP10.phx.gbl>, Ja************@msn.com says... mrclean, Here is an series of articles on how to use the System.Text.RegularExpressions.Regex class in your code.
<SNIP>
I ALREADY have VB.net code so I don't need to know how
to use it in my class, I'm trying to conmvert it to a PCRE
expression since .Net regex is NOT the same.
On 2004-11-14, Mr Clean <mrclean@p&g.com> wrote: In article <u2**************@TK2MSFTNGP10.phx.gbl>, Ja************@msn.com says... mrclean, Here is an series of articles on how to use the System.Text.RegularExpressions.Regex class in your code. <SNIP>
I ALREADY have VB.net code so I don't need to know how to use it in my class, I'm trying to conmvert it to a PCRE expression since .Net regex is NOT the same.
The ?<key> stuff represents named groups. They're a .NET extension, and
AFAIK not widely supported elsewhere.
Just drop the ?<key> syntax from your regex, and use the standard
positional parameters instead.
For perl:
my $re = q((href=["'](?!#|http|ftp|mailto|javascript)([^"']*)["']));
while(<>) {
if (/$re/) {
my $key = $1;
my $value = $2;
print "match: $key -> $value\n";
} else {
print "no match\n";
}
} This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tony C |
last post by:
I'm writing a python program which uses regular expressions, but I'm
totally new to regexps.
I've got Kuchling's "Regexp HOWTO", "Mastering Regular Expresions" by
Oreilly, and have access to...
|
by: Bibe |
last post by:
I've been trying to get this going for awhile now, and need help. I've
done a regex object, and when I use IsMatch, it's behavior is quite weird.
I am trying to use Regex to make sure that a...
|
by: H |
last post by:
This is kind of an followup on oneof my previous questions, and it has with
RegEx to do.
I have a string containing of several words. What would a good regex
expression looklike to get one match...
|
by: Dave |
last post by:
I'm struggling with something that should be fairly simple. I just don't
know the regext syntax very well, unfortunately.
I'd like to parse words out of what is basically a boolean search...
|
by: henrik |
last post by:
Hi
I have a regex question. I want to find all content of a <td
class="someclass"> tag. This means the expression should include all other
tags included between <td class="someclass"> and </td>....
|
by: jmchadha |
last post by:
I have got the following html:
"something in html ... etc.. city1... etc... <a class="font1"
href="city1.html" onclick="etc."click for <b>info</bon city1 </a>
... some html. city1.. can repeat...
|
by: Alex Maghen |
last post by:
This is a bit of an abuse of this group. Just a nit, but I'm hoping someone
really good with Regular Expressions can help me out here.
I need to write a regular expression that will do the...
|
by: =?Utf-8?B?TmF2ZWVu?= |
last post by:
Not sure if this is the right forum for this question but couldn'd find
another newsgroup.
I am new to Regular expressions and would like help in deciding which
pattern allows me to split a...
|
by: supercrossking |
last post by:
I am trying to the values of string of text in the sample before. The
ds are for digits and s is for string and string of text is for a
string with more than one or two values. I am trying to use...
|
by: Support Desk |
last post by:
That’s it exactly..thx
-----Original Message-----
From: Reedick, Andrew
Sent: Tuesday, June 03, 2008 9:26 AM
To: Support Desk
Subject: RE: regex help
The regex will now skip anything with...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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,...
|
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...
| |