How to match negative lookbehind with unknown characters between?How do you access the matched groups in a JavaScript regular expression?Javascript: negative lookbehind equivalent?How to get first character of string?Regex Match all characters between two stringsHow to match “anything up until this sequence of characters” in a regular expression?Negative Lookbehind: Match a substring that's not preceded one of a set of charactersNegative lookbehind regex (PERL) with variable characters in-betweenignore preceding spaces using negative lookbehindNegative Lookbehind not negating entire matchHow to match a regex pattern with negative lookbehind on JavaScript?

Being told my "network" isn't PCI compliant. I don't even have a server! Do I have to comply?

Has J.J.Jameson ever found out that Peter Parker is Spider-Man?

Need reasons why a satellite network would not work

How to handle many times series?

How to call made-up data?

What is Modern Vipassana?

When using the Proficiency Dice optional rule, how should they be used in determining a character's Spell Save DC?

In MTG, was there ever a five-color deck that worked well?

How to avoid a lengthy conversation with someone from the neighborhood I don't share interests with

Can't understand an ACT practice problem: Triangle appears to be isosceles, why isn't the answer 7.3~ here?

Export economy of Mars

How does shared_ptr<void> know which destructor to use?

Accurately recalling the key - can everyone do it?

Pronouns when writing from the point of view of a robot

Can I say "Gesundheit" if someone is coughing?

Does a bard know when a character uses their Bardic Inspiration?

How does Rust's 128-bit integer `i128` work on a 64-bit system?

How was the cosmonaut of the Soviet moon mission supposed to get back in the return vehicle?

Is law enforcement responsible for damages made by a search warrant?

What does "autolyco-sentimental" mean?

Representation of the concatenation at the type level

Is an "are" omitted in this sentence

A wiild aanimal, a cardinal direction, or a place by the water

What is the reason behind water not falling from a bucket at the top of loop?



How to match negative lookbehind with unknown characters between?


How do you access the matched groups in a JavaScript regular expression?Javascript: negative lookbehind equivalent?How to get first character of string?Regex Match all characters between two stringsHow to match “anything up until this sequence of characters” in a regular expression?Negative Lookbehind: Match a substring that's not preceded one of a set of charactersNegative lookbehind regex (PERL) with variable characters in-betweenignore preceding spaces using negative lookbehindNegative Lookbehind not negating entire matchHow to match a regex pattern with negative lookbehind on JavaScript?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I need to match all .get('asfd'), but only in the case where .wait(.*) doesn't exist beforehand.



.wait(500).get('asdf') // shouldn't match
.asdf('asdf').get('asdf') // should match


Unfortunately, negative look-behinds don't support quantifiers, so I'm not sure how to describe the void between .wait( and ).get('asdf') for d*



What's the approach for matching this unquantifiable area?



I figure I need some way to describe that there wasn't a wait behind the last set of parenthesis, but is there a simple way to do that?



Thanks










share|improve this question
































    0















    I need to match all .get('asfd'), but only in the case where .wait(.*) doesn't exist beforehand.



    .wait(500).get('asdf') // shouldn't match
    .asdf('asdf').get('asdf') // should match


    Unfortunately, negative look-behinds don't support quantifiers, so I'm not sure how to describe the void between .wait( and ).get('asdf') for d*



    What's the approach for matching this unquantifiable area?



    I figure I need some way to describe that there wasn't a wait behind the last set of parenthesis, but is there a simple way to do that?



    Thanks










    share|improve this question




























      0












      0








      0








      I need to match all .get('asfd'), but only in the case where .wait(.*) doesn't exist beforehand.



      .wait(500).get('asdf') // shouldn't match
      .asdf('asdf').get('asdf') // should match


      Unfortunately, negative look-behinds don't support quantifiers, so I'm not sure how to describe the void between .wait( and ).get('asdf') for d*



      What's the approach for matching this unquantifiable area?



      I figure I need some way to describe that there wasn't a wait behind the last set of parenthesis, but is there a simple way to do that?



      Thanks










      share|improve this question
















      I need to match all .get('asfd'), but only in the case where .wait(.*) doesn't exist beforehand.



      .wait(500).get('asdf') // shouldn't match
      .asdf('asdf').get('asdf') // should match


      Unfortunately, negative look-behinds don't support quantifiers, so I'm not sure how to describe the void between .wait( and ).get('asdf') for d*



      What's the approach for matching this unquantifiable area?



      I figure I need some way to describe that there wasn't a wait behind the last set of parenthesis, but is there a simple way to do that?



      Thanks







      javascript regex cypress negative-lookbehind






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 27 at 5:03







      neaumusic

















      asked Mar 27 at 1:42









      neaumusicneaumusic

      5,4952 gold badges31 silver badges50 bronze badges




      5,4952 gold badges31 silver badges50 bronze badges

























          2 Answers
          2






          active

          oldest

          votes


















          2














          Ok, it took quite a lot of experimenting, and asking this question helped to clarify the situation.



          The answer is to describe the in-between: separate from the look-behind.



          (?<!wait)
          (?:([^)]*))
          (.get(.*))


          That second section allows any character until a parenthesis. Sometimes, the first parenthesis appears inside quotes, and should be ignored. Not accounting for escaped quotes, my entire regex became:



          ((?<!wait)(.*)s*)(.get((?:"[^"]*"|'[^']*')[^)]*))


          And I use it to insert .wait() before/after .get() with match groups 1 ($1) and 2 ($2)



          $1.wait(234)$2.wait(234)


          enter image description here



          enter image description here






          share|improve this answer



























          • Wouldn't it be .*(?<!wait)(?:(.*))(.get(.*))?

            – JBis
            Mar 27 at 2:11


















          0














          I am not a regex expert, but how about this?



          /^(?!.wait(d+)).*.get(.*)/g



          Explanation:



          (?! Negative lookahead. Specifies a group
          that can not match after the main expression (if it matches, the result is discarded).



          . Escaped character. Matches a "." character (char code
          46).



          w Character. Matches a "w" character (char code 119).
          Case sensitive.



          a Character. Matches a "a" character (char code 97).
          Case sensitive.



          i Character. Matches a "i" character (char code 105).
          Case sensitive.



          t Character. Matches a "t" character (char code 116).
          Case sensitive.



          ( Escaped character. Matches a "(" character (char code
          40).



          dDigit. Matches any digit character (0-9).



          + Quantifier. Match 1 or more of the preceding
          token.



          ) Escaped character. Matches a ")" character (char code
          41).



          . Dot. Matches any character except line breaks.



          * Quantifier. Match 0 or more of the preceding
          token.



          . Escaped character. Matches a "." character (char code
          46).



          g Character. Matches a "g" character (char code 103). Case
          sensitive.



          e Character. Matches a "e" character (char code 101). Case
          sensitive.



          t Character. Matches a "t" character (char code 116). Case
          sensitive.



          ( Escaped character. Matches a "(" character (char code
          40).



          . Dot. Matches any character except line breaks.



          * Quantifier. Match 0 or more of the preceding
          token.



          ) Escaped character. Matches a ")" character (char code
          41).






          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
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55368567%2fhow-to-match-negative-lookbehind-with-unknown-characters-between%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            Ok, it took quite a lot of experimenting, and asking this question helped to clarify the situation.



            The answer is to describe the in-between: separate from the look-behind.



            (?<!wait)
            (?:([^)]*))
            (.get(.*))


            That second section allows any character until a parenthesis. Sometimes, the first parenthesis appears inside quotes, and should be ignored. Not accounting for escaped quotes, my entire regex became:



            ((?<!wait)(.*)s*)(.get((?:"[^"]*"|'[^']*')[^)]*))


            And I use it to insert .wait() before/after .get() with match groups 1 ($1) and 2 ($2)



            $1.wait(234)$2.wait(234)


            enter image description here



            enter image description here






            share|improve this answer



























            • Wouldn't it be .*(?<!wait)(?:(.*))(.get(.*))?

              – JBis
              Mar 27 at 2:11















            2














            Ok, it took quite a lot of experimenting, and asking this question helped to clarify the situation.



            The answer is to describe the in-between: separate from the look-behind.



            (?<!wait)
            (?:([^)]*))
            (.get(.*))


            That second section allows any character until a parenthesis. Sometimes, the first parenthesis appears inside quotes, and should be ignored. Not accounting for escaped quotes, my entire regex became:



            ((?<!wait)(.*)s*)(.get((?:"[^"]*"|'[^']*')[^)]*))


            And I use it to insert .wait() before/after .get() with match groups 1 ($1) and 2 ($2)



            $1.wait(234)$2.wait(234)


            enter image description here



            enter image description here






            share|improve this answer



























            • Wouldn't it be .*(?<!wait)(?:(.*))(.get(.*))?

              – JBis
              Mar 27 at 2:11













            2












            2








            2







            Ok, it took quite a lot of experimenting, and asking this question helped to clarify the situation.



            The answer is to describe the in-between: separate from the look-behind.



            (?<!wait)
            (?:([^)]*))
            (.get(.*))


            That second section allows any character until a parenthesis. Sometimes, the first parenthesis appears inside quotes, and should be ignored. Not accounting for escaped quotes, my entire regex became:



            ((?<!wait)(.*)s*)(.get((?:"[^"]*"|'[^']*')[^)]*))


            And I use it to insert .wait() before/after .get() with match groups 1 ($1) and 2 ($2)



            $1.wait(234)$2.wait(234)


            enter image description here



            enter image description here






            share|improve this answer















            Ok, it took quite a lot of experimenting, and asking this question helped to clarify the situation.



            The answer is to describe the in-between: separate from the look-behind.



            (?<!wait)
            (?:([^)]*))
            (.get(.*))


            That second section allows any character until a parenthesis. Sometimes, the first parenthesis appears inside quotes, and should be ignored. Not accounting for escaped quotes, my entire regex became:



            ((?<!wait)(.*)s*)(.get((?:"[^"]*"|'[^']*')[^)]*))


            And I use it to insert .wait() before/after .get() with match groups 1 ($1) and 2 ($2)



            $1.wait(234)$2.wait(234)


            enter image description here



            enter image description here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 27 at 5:06

























            answered Mar 27 at 1:55









            neaumusicneaumusic

            5,4952 gold badges31 silver badges50 bronze badges




            5,4952 gold badges31 silver badges50 bronze badges















            • Wouldn't it be .*(?<!wait)(?:(.*))(.get(.*))?

              – JBis
              Mar 27 at 2:11

















            • Wouldn't it be .*(?<!wait)(?:(.*))(.get(.*))?

              – JBis
              Mar 27 at 2:11
















            Wouldn't it be .*(?<!wait)(?:(.*))(.get(.*))?

            – JBis
            Mar 27 at 2:11





            Wouldn't it be .*(?<!wait)(?:(.*))(.get(.*))?

            – JBis
            Mar 27 at 2:11













            0














            I am not a regex expert, but how about this?



            /^(?!.wait(d+)).*.get(.*)/g



            Explanation:



            (?! Negative lookahead. Specifies a group
            that can not match after the main expression (if it matches, the result is discarded).



            . Escaped character. Matches a "." character (char code
            46).



            w Character. Matches a "w" character (char code 119).
            Case sensitive.



            a Character. Matches a "a" character (char code 97).
            Case sensitive.



            i Character. Matches a "i" character (char code 105).
            Case sensitive.



            t Character. Matches a "t" character (char code 116).
            Case sensitive.



            ( Escaped character. Matches a "(" character (char code
            40).



            dDigit. Matches any digit character (0-9).



            + Quantifier. Match 1 or more of the preceding
            token.



            ) Escaped character. Matches a ")" character (char code
            41).



            . Dot. Matches any character except line breaks.



            * Quantifier. Match 0 or more of the preceding
            token.



            . Escaped character. Matches a "." character (char code
            46).



            g Character. Matches a "g" character (char code 103). Case
            sensitive.



            e Character. Matches a "e" character (char code 101). Case
            sensitive.



            t Character. Matches a "t" character (char code 116). Case
            sensitive.



            ( Escaped character. Matches a "(" character (char code
            40).



            . Dot. Matches any character except line breaks.



            * Quantifier. Match 0 or more of the preceding
            token.



            ) Escaped character. Matches a ")" character (char code
            41).






            share|improve this answer































              0














              I am not a regex expert, but how about this?



              /^(?!.wait(d+)).*.get(.*)/g



              Explanation:



              (?! Negative lookahead. Specifies a group
              that can not match after the main expression (if it matches, the result is discarded).



              . Escaped character. Matches a "." character (char code
              46).



              w Character. Matches a "w" character (char code 119).
              Case sensitive.



              a Character. Matches a "a" character (char code 97).
              Case sensitive.



              i Character. Matches a "i" character (char code 105).
              Case sensitive.



              t Character. Matches a "t" character (char code 116).
              Case sensitive.



              ( Escaped character. Matches a "(" character (char code
              40).



              dDigit. Matches any digit character (0-9).



              + Quantifier. Match 1 or more of the preceding
              token.



              ) Escaped character. Matches a ")" character (char code
              41).



              . Dot. Matches any character except line breaks.



              * Quantifier. Match 0 or more of the preceding
              token.



              . Escaped character. Matches a "." character (char code
              46).



              g Character. Matches a "g" character (char code 103). Case
              sensitive.



              e Character. Matches a "e" character (char code 101). Case
              sensitive.



              t Character. Matches a "t" character (char code 116). Case
              sensitive.



              ( Escaped character. Matches a "(" character (char code
              40).



              . Dot. Matches any character except line breaks.



              * Quantifier. Match 0 or more of the preceding
              token.



              ) Escaped character. Matches a ")" character (char code
              41).






              share|improve this answer





























                0












                0








                0







                I am not a regex expert, but how about this?



                /^(?!.wait(d+)).*.get(.*)/g



                Explanation:



                (?! Negative lookahead. Specifies a group
                that can not match after the main expression (if it matches, the result is discarded).



                . Escaped character. Matches a "." character (char code
                46).



                w Character. Matches a "w" character (char code 119).
                Case sensitive.



                a Character. Matches a "a" character (char code 97).
                Case sensitive.



                i Character. Matches a "i" character (char code 105).
                Case sensitive.



                t Character. Matches a "t" character (char code 116).
                Case sensitive.



                ( Escaped character. Matches a "(" character (char code
                40).



                dDigit. Matches any digit character (0-9).



                + Quantifier. Match 1 or more of the preceding
                token.



                ) Escaped character. Matches a ")" character (char code
                41).



                . Dot. Matches any character except line breaks.



                * Quantifier. Match 0 or more of the preceding
                token.



                . Escaped character. Matches a "." character (char code
                46).



                g Character. Matches a "g" character (char code 103). Case
                sensitive.



                e Character. Matches a "e" character (char code 101). Case
                sensitive.



                t Character. Matches a "t" character (char code 116). Case
                sensitive.



                ( Escaped character. Matches a "(" character (char code
                40).



                . Dot. Matches any character except line breaks.



                * Quantifier. Match 0 or more of the preceding
                token.



                ) Escaped character. Matches a ")" character (char code
                41).






                share|improve this answer















                I am not a regex expert, but how about this?



                /^(?!.wait(d+)).*.get(.*)/g



                Explanation:



                (?! Negative lookahead. Specifies a group
                that can not match after the main expression (if it matches, the result is discarded).



                . Escaped character. Matches a "." character (char code
                46).



                w Character. Matches a "w" character (char code 119).
                Case sensitive.



                a Character. Matches a "a" character (char code 97).
                Case sensitive.



                i Character. Matches a "i" character (char code 105).
                Case sensitive.



                t Character. Matches a "t" character (char code 116).
                Case sensitive.



                ( Escaped character. Matches a "(" character (char code
                40).



                dDigit. Matches any digit character (0-9).



                + Quantifier. Match 1 or more of the preceding
                token.



                ) Escaped character. Matches a ")" character (char code
                41).



                . Dot. Matches any character except line breaks.



                * Quantifier. Match 0 or more of the preceding
                token.



                . Escaped character. Matches a "." character (char code
                46).



                g Character. Matches a "g" character (char code 103). Case
                sensitive.



                e Character. Matches a "e" character (char code 101). Case
                sensitive.



                t Character. Matches a "t" character (char code 116). Case
                sensitive.



                ( Escaped character. Matches a "(" character (char code
                40).



                . Dot. Matches any character except line breaks.



                * Quantifier. Match 0 or more of the preceding
                token.



                ) Escaped character. Matches a ")" character (char code
                41).







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 27 at 2:13

























                answered Mar 27 at 2:07









                Ali ElkhateebAli Elkhateeb

                6403 silver badges13 bronze badges




                6403 silver badges13 bronze badges






























                    draft saved

                    draft discarded
















































                    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%2f55368567%2fhow-to-match-negative-lookbehind-with-unknown-characters-between%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권, 지리지 충청도 공주목 은진현