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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:57:03+00:00 2026-06-02T23:57:03+00:00

I have following text: <option value={0}>hello1</option> <option value={1}>hello2</option> <option value={2}>hello3</option> <option value={3}>hello4</option> <option value={4}>hello5</option>

  • 0

I have following text:

    <option value="{0}">hello1</option>
    <option value="{1}">hello2</option>
    <option value="{2}">hello3</option>
    <option value="{3}">hello4</option>
    <option value="{4}">hello5</option>
    <option value="{5}">hello6</option>
    <option value="{6}">hello7</option>
    <option value="{7}">hello8</option>

All above is in one String.

I have 2 Arrays:

valueArray;
nameArray;

So, any tip on how to get the helloX into nameArray and get all value into valueArray?

//Simon

  • 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-02T23:57:04+00:00Added an answer on June 2, 2026 at 11:57 pm

    Use a regex and populate the arrays. Here is a small test program I wrote:

    public static void main(String [] args) {
        Pattern p = Pattern.compile("<option value=\"(.*?)\">(.*?)</option>");
        String line = "<option value=\"{1}\">hello0</option>";
        Matcher m = p.matcher(line);
        while (m.find()) {
            String value = m.group(1);
            String name = m.group(2);
            System.out.println(value);
            System.out.println(name);
            // Now add to your arrays
        }
    }
    

    I would not use this as a standard method for parsing a complicated xml file. Use an xml parser if this is the case.

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

Sidebar

Related Questions

I have the following text <select name=username><option value=177> Bob1 </option><option value=221> Bob2 </option><option value=227>
I have the following markup: <select style=display:none> <option value='1'>1</option> <option vlaue='2'>2</option> </select> <input type=text
I have the following code: <select id=SubjectID><option value='00'>Select Subject</option> <option value=01 selected='selected'>Software</option> <option value=02>Psychology</option>
I do have the following JavaScript. <form> <select id=sel> <option value=1>item_1</option> <option value=2>item_2</option> <option
I have the following option text that I want to put into a variable
I have the following code: $(serialNumbersDDL).children(option:gt(0)).remove(); It will delete all the options except the
I'm trying to do the following: I have an input <input type=text value=red,yellow,blue id=colors
I have the following html code <select id=WageBenifits_PayType name=WageBenifits.PayType> <option class=selectOption value= selected=selected>Please Select
I have the following dropdown list: <select name=DD1 id=DD1> <option value=B>B</option> <option value=D>D</option> <option
I have the following text in xml file: <Config Builder=LP Wizard> <Libraries> <Library Name=XCAMSource/>

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.