Really vague Regex question: string that always iterates between uppercase and lowercase lettersHow do I make the first letter of a string uppercase in JavaScript?JavaScript - checking for any lowercase letters in a stringCMake Regex to convert lower case to upper caseRegex Match all characters between two stringsDoes this regex do what I think it does?How to check whether a string contains lowercase letter, uppercase letter, special character and digit?Match all uppercase words only if there's a lowercase in the string, with one regexCheck if string contains a uppercase letter “inside” itRegex: At least one uppercase char, one lowercase char, one digit and nothing elseRegex expression that excludes underscores, but only if they are right before a number or an uppercase letter?

Why is quantum entanglement surprising?

Why is c4 bad when playing the London against a King's Indian?

Their answer is discrete, mine is continuous. They baited me into the wrong answer. I have a P Exam question

How can I instantiate a lambda closure type in C++11/14?

What can plausibly explain many of my very long and low-tech bridges?

How could a government be implemented in a virtual reality?

Can a magnetic field of an object be stronger than its gravity?

PC video game involving floating islands doing aerial combat

Through what methods and mechanisms can a multi-material FDM printer operate?

Traffic law UK, pedestrians

What happens to foam insulation board after you pour concrete slab?

Pay as you go Or Oyster card

What's the correct term describing the action of sending a brand-new ship out into its first seafaring trip?

Importance sampling estimation of power function

What happens if you do emergency landing on a US base in middle of the ocean?

Do any instruments not produce overtones?

PhD student with mental health issues and bad performance

Why did Hela need Heimdal's sword?

Does an ice chest packed full of frozen food need ice? 18 day Grand Canyon trip

What happened to all the nuclear material being smuggled after the fall of the USSR?

Avoiding cliches when writing gods

C SIGINT signal in Linux

Payment instructions from HomeAway look fishy to me

Did Darth Vader wear the same suit for 20+ years?



Really vague Regex question: string that always iterates between uppercase and lowercase letters


How do I make the first letter of a string uppercase in JavaScript?JavaScript - checking for any lowercase letters in a stringCMake Regex to convert lower case to upper caseRegex Match all characters between two stringsDoes this regex do what I think it does?How to check whether a string contains lowercase letter, uppercase letter, special character and digit?Match all uppercase words only if there's a lowercase in the string, with one regexCheck if string contains a uppercase letter “inside” itRegex: At least one uppercase char, one lowercase char, one digit and nothing elseRegex expression that excludes underscores, but only if they are right before a number or an uppercase letter?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am stuck at a regEx problem that says "Make a regex that matches a string of 10 characters that always iterate between uppercase and lowercase letters."
The question is from a online quiz kind of thing, and when you input your response it tells you whether it is right or wrong.
I have tried a bunch of options but none of them work, as the question is a bit blurry for me.



([a-z][A-Z])5



([a-z][A-Z])5|([A-Z][a-z])5



According to me, I believe that the question simply wants us to match strings like
AaAaAaAaAa or aAaAaAaAaA










share|improve this question
























  • How do you conclude that your latter attempt is wrong? What do you think is blurry about the question?

    – tripleee
    Mar 24 at 15:09

















0















I am stuck at a regEx problem that says "Make a regex that matches a string of 10 characters that always iterate between uppercase and lowercase letters."
The question is from a online quiz kind of thing, and when you input your response it tells you whether it is right or wrong.
I have tried a bunch of options but none of them work, as the question is a bit blurry for me.



([a-z][A-Z])5



([a-z][A-Z])5|([A-Z][a-z])5



According to me, I believe that the question simply wants us to match strings like
AaAaAaAaAa or aAaAaAaAaA










share|improve this question
























  • How do you conclude that your latter attempt is wrong? What do you think is blurry about the question?

    – tripleee
    Mar 24 at 15:09













0












0








0








I am stuck at a regEx problem that says "Make a regex that matches a string of 10 characters that always iterate between uppercase and lowercase letters."
The question is from a online quiz kind of thing, and when you input your response it tells you whether it is right or wrong.
I have tried a bunch of options but none of them work, as the question is a bit blurry for me.



([a-z][A-Z])5



([a-z][A-Z])5|([A-Z][a-z])5



According to me, I believe that the question simply wants us to match strings like
AaAaAaAaAa or aAaAaAaAaA










share|improve this question
















I am stuck at a regEx problem that says "Make a regex that matches a string of 10 characters that always iterate between uppercase and lowercase letters."
The question is from a online quiz kind of thing, and when you input your response it tells you whether it is right or wrong.
I have tried a bunch of options but none of them work, as the question is a bit blurry for me.



([a-z][A-Z])5



([a-z][A-Z])5|([A-Z][a-z])5



According to me, I believe that the question simply wants us to match strings like
AaAaAaAaAa or aAaAaAaAaA







python regex






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 24 at 15:28







Harshdip Singh Deogan

















asked Mar 24 at 14:39









Harshdip Singh DeoganHarshdip Singh Deogan

86




86












  • How do you conclude that your latter attempt is wrong? What do you think is blurry about the question?

    – tripleee
    Mar 24 at 15:09

















  • How do you conclude that your latter attempt is wrong? What do you think is blurry about the question?

    – tripleee
    Mar 24 at 15:09
















How do you conclude that your latter attempt is wrong? What do you think is blurry about the question?

– tripleee
Mar 24 at 15:09





How do you conclude that your latter attempt is wrong? What do you think is blurry about the question?

– tripleee
Mar 24 at 15:09












2 Answers
2






active

oldest

votes


















0














I'm not sure about the code you need to incorporate this regexp in and id it suppose to get exactly 10 characters, but you are probably in the right direction. I think you can use this:



b(?:[a-z][A-Z]|[A-Z][a-z])5b


see online: https://regex101.com/r/bynUwn/1






share|improve this answer






























    0














    Your current pattern matches a repetition of 5 times 2 characters but has no specific boundaries. What you might do is use word boundaries b([A-Z][a-z])5b



    Another option could be to use anchors to assert the start and the end of the string and use a positive lookahead to assert the length of the string to 10:



    ^(?=.10$)[A-Z]?(?:[a-z][A-Z])+[a-z]?$


    Explanation




    • ^ Start of the string


    • (?=[a-zA-Z]10$) Assert lenght of 10 characters a-z


    • [A-Z]? Match optional uppercase char


    • (?:[a-z][A-Z])+ Match 1+ times a lowercase char followed by an uppercase char


    • [a-z]? Match optional lowercase char


    • $ End of string

    Regex demo






    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%2f55324913%2freally-vague-regex-question-string-that-always-iterates-between-uppercase-and-l%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









      0














      I'm not sure about the code you need to incorporate this regexp in and id it suppose to get exactly 10 characters, but you are probably in the right direction. I think you can use this:



      b(?:[a-z][A-Z]|[A-Z][a-z])5b


      see online: https://regex101.com/r/bynUwn/1






      share|improve this answer



























        0














        I'm not sure about the code you need to incorporate this regexp in and id it suppose to get exactly 10 characters, but you are probably in the right direction. I think you can use this:



        b(?:[a-z][A-Z]|[A-Z][a-z])5b


        see online: https://regex101.com/r/bynUwn/1






        share|improve this answer

























          0












          0








          0







          I'm not sure about the code you need to incorporate this regexp in and id it suppose to get exactly 10 characters, but you are probably in the right direction. I think you can use this:



          b(?:[a-z][A-Z]|[A-Z][a-z])5b


          see online: https://regex101.com/r/bynUwn/1






          share|improve this answer













          I'm not sure about the code you need to incorporate this regexp in and id it suppose to get exactly 10 characters, but you are probably in the right direction. I think you can use this:



          b(?:[a-z][A-Z]|[A-Z][a-z])5b


          see online: https://regex101.com/r/bynUwn/1







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 24 at 14:54









          izemizem

          43357




          43357























              0














              Your current pattern matches a repetition of 5 times 2 characters but has no specific boundaries. What you might do is use word boundaries b([A-Z][a-z])5b



              Another option could be to use anchors to assert the start and the end of the string and use a positive lookahead to assert the length of the string to 10:



              ^(?=.10$)[A-Z]?(?:[a-z][A-Z])+[a-z]?$


              Explanation




              • ^ Start of the string


              • (?=[a-zA-Z]10$) Assert lenght of 10 characters a-z


              • [A-Z]? Match optional uppercase char


              • (?:[a-z][A-Z])+ Match 1+ times a lowercase char followed by an uppercase char


              • [a-z]? Match optional lowercase char


              • $ End of string

              Regex demo






              share|improve this answer





























                0














                Your current pattern matches a repetition of 5 times 2 characters but has no specific boundaries. What you might do is use word boundaries b([A-Z][a-z])5b



                Another option could be to use anchors to assert the start and the end of the string and use a positive lookahead to assert the length of the string to 10:



                ^(?=.10$)[A-Z]?(?:[a-z][A-Z])+[a-z]?$


                Explanation




                • ^ Start of the string


                • (?=[a-zA-Z]10$) Assert lenght of 10 characters a-z


                • [A-Z]? Match optional uppercase char


                • (?:[a-z][A-Z])+ Match 1+ times a lowercase char followed by an uppercase char


                • [a-z]? Match optional lowercase char


                • $ End of string

                Regex demo






                share|improve this answer



























                  0












                  0








                  0







                  Your current pattern matches a repetition of 5 times 2 characters but has no specific boundaries. What you might do is use word boundaries b([A-Z][a-z])5b



                  Another option could be to use anchors to assert the start and the end of the string and use a positive lookahead to assert the length of the string to 10:



                  ^(?=.10$)[A-Z]?(?:[a-z][A-Z])+[a-z]?$


                  Explanation




                  • ^ Start of the string


                  • (?=[a-zA-Z]10$) Assert lenght of 10 characters a-z


                  • [A-Z]? Match optional uppercase char


                  • (?:[a-z][A-Z])+ Match 1+ times a lowercase char followed by an uppercase char


                  • [a-z]? Match optional lowercase char


                  • $ End of string

                  Regex demo






                  share|improve this answer















                  Your current pattern matches a repetition of 5 times 2 characters but has no specific boundaries. What you might do is use word boundaries b([A-Z][a-z])5b



                  Another option could be to use anchors to assert the start and the end of the string and use a positive lookahead to assert the length of the string to 10:



                  ^(?=.10$)[A-Z]?(?:[a-z][A-Z])+[a-z]?$


                  Explanation




                  • ^ Start of the string


                  • (?=[a-zA-Z]10$) Assert lenght of 10 characters a-z


                  • [A-Z]? Match optional uppercase char


                  • (?:[a-z][A-Z])+ Match 1+ times a lowercase char followed by an uppercase char


                  • [a-z]? Match optional lowercase char


                  • $ End of string

                  Regex demo







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 24 at 18:26

























                  answered Mar 24 at 15:09









                  The fourth birdThe fourth bird

                  30.6k91631




                  30.6k91631



























                      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%2f55324913%2freally-vague-regex-question-string-that-always-iterates-between-uppercase-and-l%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

                      Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                      Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript