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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:49:01+00:00 2026-05-24T22:49:01+00:00

I want to find all occurrences of parent::, the called function and the parameter

  • 0

I want to find all occurrences of parent::, the called function and the parameter

For example:

parent::test( new ReflectionClass($this) );

But the following regular expression doesn’t match the outer brackets – only the inner ones:

parent::(.*)\((.*)\);
Array /* output */
(
    [0] => parent::test( new ReflectionClass($this) );
    [1] => test( new ReflectionClass
    [2] => $this) 
)

How do I have to modify the pattern?

That is for a PHP script, so I can use some other string functions, too.

  • 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-24T22:49:02+00:00Added an answer on May 24, 2026 at 10:49 pm

    What you are trying to do is generally not possible with regular expressions. To do what you want, you have to be able to count things, which is something regular expressions can’t do.

    Making the matching greedy will eventually lead to matching too much, especially when you are supporting multiple line input.

    To replace every occurence of parent:: you probably don’t have to match the method call exactly, maybe it is enough to match something like this:

    parent::(.*);
    

    Then you can replace the parent:: with something else and use the first matching group to put whatever was in the document at this position.

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

Sidebar

Related Questions

I am editing a file and want to find all occurrences of \smash{example} \smash{$example2$}
I want to find and replace (from an html page) all occurrences of src
I want to find all occurrences of ncread in every .m files under the
I want to find all occurrences of a variable name in a file, let's
How to find all occurrences of a character in a string. For example string
I want to Do these tasks: 1-find a word in pdf 2-highlight all occurrences
I want an efficient algorithm to find all occurrences of a pattern within a
I want the ability to look into a string and find all occurrences of
I have a sentence. I want to find all occurrences of a word that
In a Java program, I want to find out all the occurrences in a

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.