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 8585717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:08:10+00:00 2026-06-11T22:08:10+00:00

I got a problem with my parser. I want to read an image-link on

  • 0

I got a problem with my parser. I want to read an image-link on a webiste and this normally works fine. But today I got a link that contains special chars and the usual regex did not work.

This is how my code looks like.

Pattern t = Pattern.compile(regex.trim());

Matcher x = t.matcher(content[i].toString());
if(x.find())
{
    values[i] = x.group(1);
}

And this is the part of html, that causes trouble

<div class="open-zoomview zoomlink" itemscope="" itemtype="http://schema.org/Product"> 
<img class="zoomLink productImage" src="

http://tnm.scene7.com/is/image/TNM/template_335x300?$plus_335x300$&amp;$image=is{TNM/1098845000_prod_001}&amp;$ausverkauft=1&amp;$0prozent=1&amp;$versandkostenfrei=0" alt="Produkt Atika HB 60 Benzin-Heckenschere" title="Produkt Atika HB 60 Benzin-Heckenschere" itemprop="image" /> 
</div> 

And this is the regex I am using to get the part in the src-attribute:

<img .*src="(.*?)" .*>

I believe that it has something to do with all the special character inside the link. But I’m not sure how to escape all of them. I Already tried

Pattern.quote(content[i].toString())

But the outcome was the same: nothing found.

  • 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-11T22:08:12+00:00Added an answer on June 11, 2026 at 10:08 pm

    The . character usually only matches everything except new line characters. Therefore, your pattern won’t match if there are newlines in the img-tag.

    Use Pattern.compile(..., Pattern.DOTALL) or prepend your pattern with (?s).

    In dotall mode, the expression . matches any character, including a
    line terminator. By default this expression does not match line
    terminators.

    http://docs.oracle.com/javase/1.5.0/docs/api/java/util/regex/Pattern.html#DOTALL

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got problem with DirectX in C#. I want to draw some lines. Firstly
I've got problem for my application. I want to start connectbot from my application
have a nice day. I got problem when trying to create an image from
I want to ask about strcpy. I got problem here. Here is my code:
Previously, I have worked on local notifications, but I got problem in it now.
got a problem, can't get my head around this jquery and would appreciate your
I finally got back to fleshing out a GitCommit message mode that I want
i'm sure there is a simple way to solve this problem, but I can't
I've got a problem that keeps coming up with normalized databases and was looking
I have got my self into a problem. I have a PreferenceManager that keeps

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.