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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:13:59+00:00 2026-06-05T15:13:59+00:00

Given that an input String may be specified as follows: read(xpath(‘…’)) or xpath(‘…’) or

  • 0

Given that an input String may be specified as follows:

  • read(xpath(‘…’)) or
  • xpath(‘…’) or
  • …

Where … just holds some xpath expression, for example,/comment/text

All I really want is the xpath expression; what would be an efficient way to in general extract this value given the three possible valid patterns that could be specified.

Also, I am implementing this in Java.

  • 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-05T15:14:00+00:00Added an answer on June 5, 2026 at 3:14 pm

    Here is the basic example, it matches xpath part in both of your string examples:

    import java.util.regex.*;
    
    class Untitled {
      public static void main(String[] args) {
        String input = "read(xpath('...'))";
        String result = null;
        Pattern regex = Pattern.compile("xpath\\(\'(.*?)\'\\)");
        Matcher matcher = regex.matcher(input);
    
        if (matcher.find()) {
            result = matcher.group(1);
        }
    
        System.out.println(result);
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose that my Haskell function is given an input, which is supposed to be
Given that JTextArea t = new JTextArea(); Document d = t.getDocument(); String word1 =
The task I was trying to accomplish was that given an input pattern, e.g.
I have some template code that looks like: <input type='submit' value='{{ need.satisfied|yesno:Resend this document
I give possibility to user to input strings with unique keys that represent one-line
Given that byte,short and int are signed, why do byte and short in Java
Given that Twitter doesn't provide users' email addresses to apps [1], how can a
Given that Mark Pilgrim pulled his Dive into Greasemonkey on 2011-10-06, what is a
Given that EVAL is Evil how do I create an Array name dynamically: I
Given that I don't know at deployment time what kinds of system my code

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.