Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8482399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:49:02+00:00 2026-06-10T19:49:02+00:00

I am trying to build a regex for parsing an HTML file and getting

  • 0

I am trying to build a regex for parsing an HTML file and getting all image files. I need to do this in order to embed images before sending it as an e-mail.

Is there a “list of places” where images can be referenced? For example, I know I need to look inside <img src="here" />, or in a CSS style url('here'), or background='here', but does that cover all cases?

And does the regex already exist somewhere? I find writing regexes painful, and I don’t want to miss a case, or forget to handle some broken HTML markup.

For <img> tags, I found something like this:

(?<=img\s+src\=[\x27\x22])(?<Url>[^\x27\x22]*)(?=[\x27\x22])

but I don’t know how to include other places.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:49:04+00:00Added an answer on June 10, 2026 at 7:49 pm

    Don’t use regex to parse html, instead use an Html parser like HtmlAgilityPack

    HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
    doc.LoadHtml(html);
    
    var a = doc.DocumentNode.Descendants("img")
                .Select(x => x.Attributes["src"].Value)
                .ToArray();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build a regex somewhat like this: [match-word] ... [exclude-specific-word] ... [match-word]
I've been whacking on this regex for a while, trying to build something that
I have this text block [QUOTE=Name;123]Text[/QUOTE] I am trying to build a regex to
Trying to build openssl-fips-2.0 with NDK, before I was lucky found this link and
I'm trying to build some code. Here is the error I'm getting: main.o: In
I'm trying build a regex that will replace any characters not of the format:
Hi all im trying to build a regular expression which will sustain the following
I'm trying to build a regex to parse our syslogs. I was asked to
I'm trying to build a regex to determine if a string contains a byte
I am trying to build simple regex with js. the rules for the regex

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.