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

  • Home
  • SEARCH
  • 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 8954839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:24:11+00:00 2026-06-15T14:24:11+00:00

I am making an Android application that can fetch the new announcements from the

  • 0

I am making an Android application that can fetch the new announcements from the website of my university.

This is the HTML code in the website:

sample_html_code http://img690.imageshack.us/img690/1079/88210050.png

Text version:

<table border="1" width="90%" class="duyuru">
<tbody>
<tr>
<td>
<h3 class="duyuru">Additional Quotas for the Technical Electives</h3>
"19/09/2012"
<h4 class="duyuru">"Additional Quotas for Technical Electives offered in...</h4>
<span class="duyuru"></span>
<br>
<a href="news_image/96.doc">Download</a>
</td>
</tr>
</tbody>
</table>

I can get the first and third lines “Additional Quotas for Technical Electives” and “Additional Quotas for …” by using the piece of code below. However, I cannot get the date information (19/09/2012) located between h3 and h4 lines.

String patternStr ="\\<h3 class=\"duyuru\".*?\\>(.*?)\\</h3\\>";
patternStr+="(.*?)";     // This line is problematic
patternStr+=".*?\\<h4 class=\"duyuru\".*?\\>(.*?)\\</h4\\>";

Pattern pattern = Pattern.compile(patternStr, Pattern.DOTALL);
Matcher matcher = pattern.matcher(content);

String name = "";
String date = "";
String details = "";

while (matcher.find()){

    name    = matcher.group(1);
    date = matcher.group(2);
    details = matcher.group(3);

    Announcement announcement = new Announcement();

    announcement.setName(name);
    announcement.setDate(date);
    announcement.setDetails(details);

    announcements.add(announcement);
}

I tried using

.*?\"(.*?)\"

but it didn’t work. When I do this, it gets the string “duyuru” from the line starting with h4 tag instead of the date information.

Anyone have an idea how can I grab the date information?

Thanks in advance.

  • 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-15T14:24:13+00:00Added an answer on June 15, 2026 at 2:24 pm

    Your regular expression misses the newlines and whitespace in the input.

    The simplest possible match I could come up with is:

    "\\<h3 class=\"duyuru\".*?\\>\\n?\\s*(.*?)\\n?\\s*\\</h3\\>"
    

    But keep in mind that such a regular expression is highly specific to your HTML.

    My advice would be to have a look at a real HTML parser for Java, such as TagSoup. Once you start using one of those, parsing this type of HTML document becomes a breeze.

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

Sidebar

Related Questions

I am making an android application that loads files from a directory on the
I'm making an android application that loads a byte array from a database. But
I am making an android application, which takes an image from camera and then
I am making an HTTP get request to a website for an android application
I am making an android application that needs to add items to a dynamic
I am making an android application that needs to use a ListView . I
I am making an android application that uses these views: (Root) - LinearLayout (Child
I am making an android application that uses a listview. I want to get
I'm trying to create an application that can use the android as a fax
I am making an application in Android. This is a small application of an

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.