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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:12:29+00:00 2026-06-04T04:12:29+00:00

im new to Regular Expressions in general and I start to read more about

  • 0

im new to Regular Expressions in general and I start to read more about them , so be gentle 🙂

I want to find all words that begins with my(" or my('. The word itself can contain underscores, characters, digits, basically any char. But it should end with ") or ').

So I tried the following:

Pattern.compile("_(\"(.*)\")"); // for underscores first, instead of my

and

Pattern.compile("(my)(\"(.*)\")");

But this give me other things back as well, and I can’t see why and where I making the thinking mistake…

Thanks

  • 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-04T04:12:30+00:00Added an answer on June 4, 2026 at 4:12 am

    If you want to match my("xxx") and my('xxx') but not my("xxx') then try the following expression:

    my\((?:"[^"]*"|'[^']*')\)
    

    Here’s a short breakdown of the expression:

    • my\(...\) means the match should start with my( and end with )
    • (?:"[^"]*"|'[^']*') means a sequence of characters surrounded by either double quotes or single quotes (therefore the character class means “any character not being a double quote” or “any character not being a single quote”)

    Edit:

    The problem with the expression (my)("(.*)") is, that it is greedy and the match would start at my(" but end on the last ") due to the .* which matches anything. Thus it would match my("xxx") your("yyy") because .* matches xxx") your("yyy.

    For more information on regular expressions see http://www.regular-expressions.info

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

Sidebar

Related Questions

I'm completely new to regular expressions, and I need to filter all the words
I am not new to regular expressions and I use them all the time.
I'm new to regular expressions and I need to find a regular expression that
I'm rather new with Regular Expressions in general. Basically, I want to rewrite a
I'm new to regular expressions, and have no clue where to start, it's like
So I'm new to regular expressions and having difficulty understanding them. To get my
I am new to regular expressions.I am trying to find the Images doesn't having
I'm new to regular expressions and can't get the hang of them. Can you
I am fairly new to regular expressions and the more and more I use
I'm new to regular expressions in Java (or any language, for that matter) and

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.