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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:22:27+00:00 2026-05-26T07:22:27+00:00

I have strings that come from outside to my application and may look like

  • 0

I have strings that come from outside to my application and may look like these with quotes:

Prefix content. "Some content goes here". More contents without quotes.
Prefix content. "Another "Additional" goes here". More contents without quotes.
Prefix content. "Just another "content". More contents without quotes.

The key note is that the strings come with quotes and I need to process these quotes properly. Actually I need to catch all the content inside quotes. I tried patterns like .*(".*").* and .*(".+").* but they seem to catch only content between two closest quotes.

  • 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-26T07:22:28+00:00Added an answer on May 26, 2026 at 7:22 am

    Looks like you just want everything from the first quote to the last quote, even if there are other quotes between. This should suffice:

    ".*"
    

    The leading and trailing .* in your regex were never needed, and the leading one was distorting your results. It would initially consume the whole input, then back off just far enough to let the rest of the regex match, meaning the (".*") would only ever match the last two quotes.

    You don’t need the parentheses, either. The part of the string you’re after is now the entire match, so you can retrieve it with group(0) instead of group(1). If there may be newlines in the string and you want to match those, too, you can change it to:

    (?s)".*"
    

    The . metacharacter normally doesn’t match newlines, but (?s) turns on DOTALL mode for the rest of the regex.


    EDIT: I forgot to mention that you should be using the search() method in this case, not match(). match() only works if the match is found at the very beginning of the input, as if you had added the start anchor (e.g., ^".*"). search() performs a more traditional regex match, where the match can appear anywhere in the input. (ref)

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

Sidebar

Related Questions

i have various strings that look like that: $(gateway.jms.jndi.ic.url,0,tibjmsnaming, tcp)/topic/$(gateway.destination.prefix)$(gateway.StatusTopicName),$(gateway.jms.jndi.ic.username),$(gateway.jms.jndi.ic.password),abinding,tBinding i'm trying to figure
I have strings that look about like this: stringA = @29.88; stringB = @2564;
say i have strings that are sent back and forth from the client, and
I have 2 strings that I'd like to compare, and return the positions of
I have some strings that I am pulling out of a database and I
I have two development teams, that come from different groups. Group A develops against
I have a list of strings whose values come from a fixed set. I
I have a series of strings that come in, that are essentially dollar values,
I have 2 arrays in PHP that look something like this: $rows = array(11,12,14,14,11,13,12,11);
I have some code that needs Unicode strings for the most part, but I

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.