Hello
Is it possible to retrieve then inner-text from a link with regular expressions?
For example, I can retrieve all links with regular expressions. With: -
string pattern = @"<a href="".*"">.*</a>";
-
MatchCollection mc = Regex.Matches(webBrowser1.Document.Body.InnerHtml, pattern);
-
-
foreach(object obj in mc)
-
{
-
Console.WriteLine(obj.ToString());
-
}
-
So i get the following matches: -
<a href="http://www.thescripts.com">The Scripts</a>
-
<a href="http://www.mysite.com">My Site</a>
-
<a href="http://www.anothersite.com">Yet another site</a>
-
But is it also possible to retrieve only the innertexts? So I would get the following results: -
The Scripts
-
My Site
-
Yet another site
-
Or even better, more innertexts in one item like: -
http://www.thescripts.com The Scripts
-
http://www.mysite.com My Site
-
http://www.anothersite.com Yet another site
-
Thanks
3 2764
Hi Guys,
Nice to see that somebody needs my Regular Expression Talent...
Try This,
This will solve your problem:
string pattern = @"(\<a href="")(.*?)(" "\>)(.*?)\</a\>";
MatchCollection match=Regex.Mat ches(webBrowser 1.Document.Body .InnerHtml, pattern,RegexOp tions.IgnoreCas e);
foreach (Match obj in match)
{
Console.WriteLi ne(obj.Groups[2].Value.ToString () + " => " + obj.Groups[4].Value.ToString ());
}
Notes:
1. () define groups in search pattern.
2. RegexOptions.Ig noreCase implements case insensitive search.
3. object -> Match in foreach to retrieve groups.
Say thanks dear if you like it, it shows our goodness.
Paresh
Hello
Is it possible to retrieve then inner-text from a link with regular expressions?
For example, I can retrieve all links with regular expressions. With: -
string pattern = @"<a href="".*"">.*</a>";
-
MatchCollection mc = Regex.Matches(webBrowser1.Document.Body.InnerHtml, pattern);
-
-
foreach(object obj in mc)
-
{
-
Console.WriteLine(obj.ToString());
-
}
-
So i get the following matches: -
<a href="http://www.thescripts.com">The Scripts</a>
-
<a href="http://www.mysite.com">My Site</a>
-
<a href="http://www.anothersite.com">Yet another site</a>
-
But is it also possible to retrieve only the innertexts? So I would get the following results: -
The Scripts
-
My Site
-
Yet another site
-
Or even better, more innertexts in one item like: -
http://www.thescripts.com The Scripts
-
http://www.mysite.com My Site
-
http://www.anothersite.com Yet another site
-
Thanks
OMG, Thanks a lot.
I will do as you requested:
Thanks dear!!!!!!!!
You are my god
Hi Guy,
No need to put me in that much big category...
Just a simple thanks can work.... :)
Have a nice time..
Paresh
OMG, Thanks a lot.
I will do as you requested:
Thanks dear!!!!!!!!
You are my god
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Murat Tasan |
last post by:
hi, i am having a small problem with constructing an inner class.
i am using an inner class (and not a static nested class) because the
methods of the inner class need access to the enclosing object's members.
now, i have an enclosing class, which has a static factory method (loads
an instance of the enclosing class from a serialized file, and returns
it).
during the loading, some initialization takes place. one of the
initialization...
|
by: Prem |
last post by:
Hi,
I am having many problems with inner join. my first problem is :
1) I want to know the precedance while evaluating query with multiple
joins.
eg.
select Employees.FirstName, Employees.LastName, TerritoryID,
Employees.EmployeeID,
RegionID, ProductID
from Employees
|
by: olov.johansson |
last post by:
Hi,
given two nested functions:
function outer() {
function inner() {
}
}
Is it determined by the ECMAScript standard that inner should be a
property of outer, thus a "document.write(outer.inner);" on the global
|
by: dmonroe |
last post by:
hi group --
Im having a nested inner join problem with an Access SQl
statement/Query design. Im running the query from ASP and not usng the
access interface at all. Here's the tables:
tblEmployees
empId -- EmpName -- EmpRole -- EmpManager
-------....------------.... ---------....---------------
1........ dan yella..........1..........2
|
by: MP |
last post by:
Hi
trying to begin to learn database using vb6, ado/adox, mdb format, sql
(not using access...just mdb format via ado)
i need to group the values of multiple fields
- get their possible variations(combination of fields),
- then act on each group in some way ...eg ProcessRs (oRs as RecordSet)...
the following query will get me the distinct groups
| |
by: Martijn Mulder |
last post by:
A construction like this:
class Outer
{
class Inner:Outer
{
}
}
compiles without problem but does it introduce infinity?
|
by: mrstephengross |
last post by:
I'm making progress on mixing templates with friends (sounds like a
drinking game, huh?). Anyway, here's the situation. I've got an "Outer"
class with a private "Inner" class (sub-class, technically). I want to
declaring an unrelated "Thing" class to be a friend of the inner class.
However, since the inner class is private, the compiler complains.
Here's what the code looks like:
====================================================...
|
by: Matthias Buelow |
last post by:
Hi folks,
I've got something like:
class Outer {
int f();
friend class Inner;
class Inner {
int g() {
|
by: from.future.import |
last post by:
Hi,
I encountered garbage collection behaviour that I didn't expect when
using a recursive function inside another function: the definition of
the inner function seems to contain a circular reference, which means
it is only collected by the mark-and-sweep collector, not by reference
counting. Here is some code that demonstrates it:
===
def outer():
|
by: MATTXtwo |
last post by:
I have this store procedure to select data from table with join like this...SELECT tblPeribadi.Personel_No, tblPeribadi.Nama,tblCompany.Keterangan as Company_Code, tblPeribadi.Jawatan, tblPeribadi.Taraf_Jawatan,
tblGroup.Keterangan AS Kumpulan,tblPeribadi.Gred,tblBusiness_Area.Keterangan AS Business_Area,tblCost_Center.Keterangan AS Kod_Pusat_Kos, tblPeribadi.IC_Baru, tblPeribadi.IC_Lama,
...
|
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...
| |
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,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
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
|
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...
| |