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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:49:01+00:00 2026-06-18T07:49:01+00:00

I am new to regex . I am looking for regular expression which matches

  • 0

I am new to regex. I am looking for regular expression which matches following pattern and extract the string,

 key1=test1
 key2="test1" // which will extract test1 stripping quotes
 key3=New test
 key4=New" "test // which will extract New" "test - as it is if the quotes come in between

I tried with \\s*(\\S+)\\s*=\\s*(\\S+*+) , but not sure how to include quotes if present. Any help will be really appreciated.

  • 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-18T07:49:02+00:00Added an answer on June 18, 2026 at 7:49 am

    Here’s a solution without regex to avoid problems with nested quotes:

    String extractValue(String input) {
      // check if '=' is present here...
      String[] pair = input.split("=", 2);
      String value = pair[1];
      if (value.startsWith("\"") && value.endsWith("\"")) {
          return value.substring(1, value.length() - 1);
      }
      return value;
    }
    

    Basically this is not without regex, because of the use of split(), but it’s not using regex the way you were planning to use it.

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

Sidebar

Related Questions

I was looking at a C# Regex tutorial which stated that \d matches a
I'm looking for a regular expression to match an alphanumeric string. If the string
Looking for help in matching the curly brackets in a regular expression pattern. I've
I am new to Regex .I want to match pattern of my file ..
I have the following code: public void DriveRecursion(string retPath) { string pattern = @[~#&!%\+\{\}]+;
I am new to regex and am looking to trim a known number of
Well, I'm pretty new on regex and in particular on JavaScript regexp. I'm looking
Assume I have the string: 10,11,12,13,14,ABC,DEF,GHI,66 I am looking to run a regex against
I'm pretty new to regular expressions. I've worked out the string (?i)\$url\[([0-9])\] to match
I'm looking for a regular expression to use in Refex.Replace that allows me to

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.