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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:32:18+00:00 2026-05-25T00:32:18+00:00

How would I find and get a value between two strings? ie: <a>3</a> I’m

  • 0

How would I “find” and “get” a value between two strings?

ie: <a>3</a>

I’m reading a file to find the location of <a>, where that starts, then it will stop reading when it finds </a> The value I want to return is “3”.

Using JRE 6

  • 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-05-25T00:32:18+00:00Added an answer on May 25, 2026 at 12:32 am

    Your two main options are:

    1) preferred but potentially complicated: using an XML/HTML parser and getting the text within the first “a” element. e.g. using Jsoup (thanks @alpha123):

    Jsoup.parse("<a>3</a>").select("a").first().text(); // => "3"
    

    2) easier but not very reliable: using a regular expression to extract the characters between the <a> and </a> strings. e.g.:

    String s = "<a>3</a>";
    Pattern p = Pattern.compile("<a>(.*?)</a>")
    Matcher m = p.matcher(s);
    if (m.find()) {
      System.out.println(m.group(1)); // => "3"
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to .get a page and then use jquery to find elements
How would get find an average from an array? If I have the array:
I would like to get contents of some stream or project I can find
Anyone knows any free Visual Studio add-in that would find and/or delete dead (unused)
I would like to find the first digit of the value in a textbox
I would like to find text which is between the < and > characters,
I am trying to find the difference between two dates. The first of the
I would find out the floppy inserted state : no floppy inserted unformatted floppy
I'm wondering if any other C# developers would find it an improvement to have
How would you find the fractional part of a floating point number in PHP?

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.