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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:40:42+00:00 2026-06-07T01:40:42+00:00

My question: What’s a good way to parse the information below? I have a

  • 0

My question: What’s a good way to parse the information below?

I have a java program that gets it’s input from XML. I have a feature which will send an error email if there was any problem in the processing. Because parsing the XML could be a problem, I want to have a feature that would be able to regex the emails out of the xml (because if parsing was the problem then I couldn’t get the error e-mails out of the xml normally).

Requirements:

  • I want to be able to parse the to, cc, and bcc attributes seperately
  • There are other elements which have to, cc, and bcc attributes
  • Whitespace does not matter, so my example may show the attributes on a newline, but that’s not always the case.
  • The order of the attributes does not matter.

Here’s an example of the xml:

<error_options
  to="your_email@your_server.com"
  cc="cc_error@your_server.com"
  bcc="bcc_error@your_server.com"
  reply_to="someone_else@their_server.com"
  from="bo_error@some_server.org"
  subject="Error running System at @@TIMESTAMP@@"
  force_send="false"
  max_email_size="10485760"
  oversized_email_action="zip;split_all"
>

I tried this error_options.{0,100}?to="(.*?)", but that matched me down to reply_to. That made me think there are probably some cases I might miss, which is why I’m posting this as a question.

  • 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-07T01:40:43+00:00Added an answer on June 7, 2026 at 1:40 am

    This piece will put all attributes from your String s="<error_options..." into a map:

        Pattern p = Pattern.compile("\\s+?(.+?)=\"(.+?)\\s*?\"",Pattern.DOTALL);
        Map a = new HashMap() ;
        Matcher m = p.matcher(s) ;
        while( m.find() ) {
            String key = m.group(1).trim() ;
            String val = m.group(2).trim() ; 
            a.put(key, val) ;
        }
    

    …then you can extract the values that you’re interested in from that map.

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

Sidebar

Related Questions

Question: input an int number ex: ABCD, verify that is ABCD = AB*CD or
Question update: I have figured out that importing JQuery (even without using it at
Question Please note that the solution to this is directly below using Eugen's view
Question is quite simple. Let's say I have an URL config with line: url(r'^models/(?P<model_group_id>[0-9]+)/(?P<page>\d+)/$',
Question: I want to test an if statement in PostgreSQL: IF (SELECT COUNT(*) FROM
Question is not correctly framed i know, how do i code the below logic
Question: Can I override default functions in Javascript? Background: After figuring out that I
Question: Upon click, I see that evt.target.attributes stores all of the attributes in an
Question Is it possible to create a second Preference Dialog that can take some
Question Does anyone know of a way to round a float to the nearest

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.