get all text between bracket but skip nested bracketHow to replace plain URLs with links?How do I extract text that lies between parentheses (round brackets)?Secure hash and salt for PHP passwordsHow do you use a variable in a regular expression?Regular expression to extract text between square bracketsReference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?How can I write a regex which matches non greedy?regular expression to get text between brackets that have text between bracketsHow to exclude text between two curly brackets with regex?

Can the harmonic series explain the origin of the major scale?

Was the picture area of a CRT a parallelogram (instead of a true rectangle)?

Is there an wasy way to program in Tikz something like the one in the image?

Can I Retrieve Email Addresses from BCC?

What is the term when two people sing in harmony, but they aren't singing the same notes?

What does the "3am" section means in manpages?

How will losing mobility of one hand affect my career as a programmer?

Golf game boilerplate

Why are all the doors on Ferenginar (the Ferengi home world) far shorter than the average Ferengi?

Can I use my Chinese passport to enter China after I acquired another citizenship?

What if somebody invests in my application?

Are taller landing gear bad for aircraft, particulary large airliners?

How do I repair my stair bannister?

Partial sums of primes

How to check participants in at events?

Why isn't KTEX's runway designation 10/28 instead of 9/27?

Java - What do constructor type arguments mean when placed *before* the type?

Are Warlocks Arcane or Divine?

Hostile work environment after whistle-blowing on coworker and our boss. What do I do?

Latex for-and in equation

Indicating multiple different modes of speech (fantasy language or telepathy)

How can a jailer prevent the Forge Cleric's Artisan's Blessing from being used?

A workplace installs custom certificates on personal devices, can this be used to decrypt HTTPS traffic?

Calculating the number of days between 2 dates in Excel



get all text between bracket but skip nested bracket


How to replace plain URLs with links?How do I extract text that lies between parentheses (round brackets)?Secure hash and salt for PHP passwordsHow do you use a variable in a regular expression?Regular expression to extract text between square bracketsReference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?How can I write a regex which matches non greedy?regular expression to get text between brackets that have text between bracketsHow to exclude text between two curly brackets with regex?













2















Im trying to figure out how to get the text between two bracket tags but dont stop at the first closing )



__('This is a (TEST) all of this i want') i dont want any of this;


my current pattern is __((.*?))



which gives me



__('This is a (TEST) 


but i want



__('This is a (TEST) all of this i want') 


Thanks










share|improve this question









New contributor




Winners2113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    2















    Im trying to figure out how to get the text between two bracket tags but dont stop at the first closing )



    __('This is a (TEST) all of this i want') i dont want any of this;


    my current pattern is __((.*?))



    which gives me



    __('This is a (TEST) 


    but i want



    __('This is a (TEST) all of this i want') 


    Thanks










    share|improve this question









    New contributor




    Winners2113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      2












      2








      2








      Im trying to figure out how to get the text between two bracket tags but dont stop at the first closing )



      __('This is a (TEST) all of this i want') i dont want any of this;


      my current pattern is __((.*?))



      which gives me



      __('This is a (TEST) 


      but i want



      __('This is a (TEST) all of this i want') 


      Thanks










      share|improve this question









      New contributor




      Winners2113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      Im trying to figure out how to get the text between two bracket tags but dont stop at the first closing )



      __('This is a (TEST) all of this i want') i dont want any of this;


      my current pattern is __((.*?))



      which gives me



      __('This is a (TEST) 


      but i want



      __('This is a (TEST) all of this i want') 


      Thanks







      php regex regex-negation






      share|improve this question









      New contributor




      Winners2113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Winners2113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited Mar 21 at 14:49









      Wiktor Stribiżew

      325k16146226




      325k16146226






      New contributor




      Winners2113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Mar 21 at 14:45









      Winners2113Winners2113

      132




      132




      New contributor




      Winners2113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Winners2113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Winners2113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          3 Answers
          3






          active

          oldest

          votes


















          0














          You forgot to escape two parenthesis in your regex : __((.*));



          Check on regex101.com.






          share|improve this answer






























            1














            You may use a regex subroutine to match text inside nested parentheses after __:



            if (preg_match_all('~__((((?:[^()]++|(?1))*)))~', $s, $matches)) 
            print_r($matches[2]);



            See the regex demo.



            Details




            • __ - a __ substring


            • ((((?:[^()]++|(?1))*))) - Group 1 (it will be recursed using the (?1) subroutine):


              • ( - a ( char


              • ((?:[^()]++|(?1))*) - Group 2 capturing 0 or more repetitions of any 1+ chars other than ( and ) or the whole Group 1 pattern is recursed


              • ) - a ) char.


            See the PHP demo:



            $s = "__('This is a (TEST) all of this i want') i dont want any of this; __(extract this)";
            if (preg_match_all('~__((((?:[^()]++|(?1))*)))~', $s, $matches))
            print_r($matches[2]);

            // => Array ( [0] => 'This is a (TEST) all of this i want' [1] => extract this )





            share|improve this answer






























              0














              Use the pattern __((.*)?).



              The escapes the parentheses to catch literal parentheses. This then captures all the text inside that set of parentheses.






              share|improve this answer






















                Your Answer






                StackExchange.ifUsing("editor", function ()
                StackExchange.using("externalEditor", function ()
                StackExchange.using("snippets", function ()
                StackExchange.snippets.init();
                );
                );
                , "code-snippets");

                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "1"
                ;
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function()
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled)
                StackExchange.using("snippets", function()
                createEditor();
                );

                else
                createEditor();

                );

                function createEditor()
                StackExchange.prepareEditor(
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader:
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                ,
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );






                Winners2113 is a new contributor. Be nice, and check out our Code of Conduct.









                draft saved

                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55283093%2fget-all-text-between-bracket-but-skip-nested-bracket%23new-answer', 'question_page');

                );

                Post as a guest















                Required, but never shown

























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                0














                You forgot to escape two parenthesis in your regex : __((.*));



                Check on regex101.com.






                share|improve this answer



























                  0














                  You forgot to escape two parenthesis in your regex : __((.*));



                  Check on regex101.com.






                  share|improve this answer

























                    0












                    0








                    0







                    You forgot to escape two parenthesis in your regex : __((.*));



                    Check on regex101.com.






                    share|improve this answer













                    You forgot to escape two parenthesis in your regex : __((.*));



                    Check on regex101.com.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 21 at 14:48









                    iArcadiaiArcadia

                    1,082619




                    1,082619























                        1














                        You may use a regex subroutine to match text inside nested parentheses after __:



                        if (preg_match_all('~__((((?:[^()]++|(?1))*)))~', $s, $matches)) 
                        print_r($matches[2]);



                        See the regex demo.



                        Details




                        • __ - a __ substring


                        • ((((?:[^()]++|(?1))*))) - Group 1 (it will be recursed using the (?1) subroutine):


                          • ( - a ( char


                          • ((?:[^()]++|(?1))*) - Group 2 capturing 0 or more repetitions of any 1+ chars other than ( and ) or the whole Group 1 pattern is recursed


                          • ) - a ) char.


                        See the PHP demo:



                        $s = "__('This is a (TEST) all of this i want') i dont want any of this; __(extract this)";
                        if (preg_match_all('~__((((?:[^()]++|(?1))*)))~', $s, $matches))
                        print_r($matches[2]);

                        // => Array ( [0] => 'This is a (TEST) all of this i want' [1] => extract this )





                        share|improve this answer



























                          1














                          You may use a regex subroutine to match text inside nested parentheses after __:



                          if (preg_match_all('~__((((?:[^()]++|(?1))*)))~', $s, $matches)) 
                          print_r($matches[2]);



                          See the regex demo.



                          Details




                          • __ - a __ substring


                          • ((((?:[^()]++|(?1))*))) - Group 1 (it will be recursed using the (?1) subroutine):


                            • ( - a ( char


                            • ((?:[^()]++|(?1))*) - Group 2 capturing 0 or more repetitions of any 1+ chars other than ( and ) or the whole Group 1 pattern is recursed


                            • ) - a ) char.


                          See the PHP demo:



                          $s = "__('This is a (TEST) all of this i want') i dont want any of this; __(extract this)";
                          if (preg_match_all('~__((((?:[^()]++|(?1))*)))~', $s, $matches))
                          print_r($matches[2]);

                          // => Array ( [0] => 'This is a (TEST) all of this i want' [1] => extract this )





                          share|improve this answer

























                            1












                            1








                            1







                            You may use a regex subroutine to match text inside nested parentheses after __:



                            if (preg_match_all('~__((((?:[^()]++|(?1))*)))~', $s, $matches)) 
                            print_r($matches[2]);



                            See the regex demo.



                            Details




                            • __ - a __ substring


                            • ((((?:[^()]++|(?1))*))) - Group 1 (it will be recursed using the (?1) subroutine):


                              • ( - a ( char


                              • ((?:[^()]++|(?1))*) - Group 2 capturing 0 or more repetitions of any 1+ chars other than ( and ) or the whole Group 1 pattern is recursed


                              • ) - a ) char.


                            See the PHP demo:



                            $s = "__('This is a (TEST) all of this i want') i dont want any of this; __(extract this)";
                            if (preg_match_all('~__((((?:[^()]++|(?1))*)))~', $s, $matches))
                            print_r($matches[2]);

                            // => Array ( [0] => 'This is a (TEST) all of this i want' [1] => extract this )





                            share|improve this answer













                            You may use a regex subroutine to match text inside nested parentheses after __:



                            if (preg_match_all('~__((((?:[^()]++|(?1))*)))~', $s, $matches)) 
                            print_r($matches[2]);



                            See the regex demo.



                            Details




                            • __ - a __ substring


                            • ((((?:[^()]++|(?1))*))) - Group 1 (it will be recursed using the (?1) subroutine):


                              • ( - a ( char


                              • ((?:[^()]++|(?1))*) - Group 2 capturing 0 or more repetitions of any 1+ chars other than ( and ) or the whole Group 1 pattern is recursed


                              • ) - a ) char.


                            See the PHP demo:



                            $s = "__('This is a (TEST) all of this i want') i dont want any of this; __(extract this)";
                            if (preg_match_all('~__((((?:[^()]++|(?1))*)))~', $s, $matches))
                            print_r($matches[2]);

                            // => Array ( [0] => 'This is a (TEST) all of this i want' [1] => extract this )






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Mar 21 at 14:53









                            Wiktor StribiżewWiktor Stribiżew

                            325k16146226




                            325k16146226





















                                0














                                Use the pattern __((.*)?).



                                The escapes the parentheses to catch literal parentheses. This then captures all the text inside that set of parentheses.






                                share|improve this answer



























                                  0














                                  Use the pattern __((.*)?).



                                  The escapes the parentheses to catch literal parentheses. This then captures all the text inside that set of parentheses.






                                  share|improve this answer

























                                    0












                                    0








                                    0







                                    Use the pattern __((.*)?).



                                    The escapes the parentheses to catch literal parentheses. This then captures all the text inside that set of parentheses.






                                    share|improve this answer













                                    Use the pattern __((.*)?).



                                    The escapes the parentheses to catch literal parentheses. This then captures all the text inside that set of parentheses.







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Mar 21 at 14:49









                                    k97513k97513

                                    1,450616




                                    1,450616




















                                        Winners2113 is a new contributor. Be nice, and check out our Code of Conduct.









                                        draft saved

                                        draft discarded


















                                        Winners2113 is a new contributor. Be nice, and check out our Code of Conduct.












                                        Winners2113 is a new contributor. Be nice, and check out our Code of Conduct.











                                        Winners2113 is a new contributor. Be nice, and check out our Code of Conduct.














                                        Thanks for contributing an answer to Stack Overflow!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid


                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.

                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55283093%2fget-all-text-between-bracket-but-skip-nested-bracket%23new-answer', 'question_page');

                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                                        SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                                        은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현