What would be the Regex expression to get the first letter after a group of character and some integers?Regex for numbers onlyConverting user input string to regular expressionRegular expression to extract text between square bracketsRegular Expression: Any character that is NOT a letter or numberIs there a RegExp.escape function in Javascript?How to extract a substring using regexGreedy vs. Reluctant vs. Possessive QuantifiersReplace only some groups with Regexd is less efficient than [0-9]How to use Regular Expressions (Regex) in Microsoft Excel both in-cell and loops

A life of PhD: is it feasible?

Is there a better way to do partial sums of array items in JavaScript?

Problem with pronounciation

What does the homotopy coherent nerve do to spaces of enriched functors?

Realistic, logical way for men with medieval-era weaponry to compete with much larger and physically stronger foes

Makefile for a simple Debian Repo

How much web presence should I have?

How to make a composition of functions prettier?

Why does there seem to be an extreme lack of public trashcans in Taiwan?

Was planting UN flag on Moon ever discussed?

Are the guests in Westworld forbidden to tell the hosts that they are robots?

Why are ambiguous grammars bad?

Why would a home insurer offer a discount based on credit score?

What's the best way to quit a job mostly because of money?

In The Incredibles 2, why does Screenslaver's name use a pun on something that doesn't exist in the 1950s pastiche?

Parsing text written the millitext font

What is the STRONGEST end-of-line knot to use if you want to use a steel-thimble at the end, so that you've got a steel-eyelet at the end of the line?

What does this line mean in Zelazny's "The Courts of Chaos"?

How many sets of dice do I need for D&D?

How to generate list of *all* available commands and functions?

How do I avoid typing "git" at the begining of every Git command?

How can you estimate a spike story?

What is the proper event in Extended Events to track stored procedure executions?

Professor Roman loves to teach unorthodox Chemistry



What would be the Regex expression to get the first letter after a group of character and some integers?


Regex for numbers onlyConverting user input string to regular expressionRegular expression to extract text between square bracketsRegular Expression: Any character that is NOT a letter or numberIs there a RegExp.escape function in Javascript?How to extract a substring using regexGreedy vs. Reluctant vs. Possessive QuantifiersReplace only some groups with Regexd is less efficient than [0-9]How to use Regular Expressions (Regex) in Microsoft Excel both in-cell and loops






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








1















I have a string that the following structure:



ABCD123456EFGHIJ78 but sometimes it's missing a number or a character like:



ABC123456EFGHIJ78 or
ABCD123456E or
ABCD12345EFGHIJ78
etc.



That's why I need regular expressions.



What I want to extract is the first letter of the third group, in this case 'E'.



I have the following regex:



(D+)+(d+)+(D1)3


but I don't get the letter E.










share|improve this question

















  • 2





    See regex101.com/r/5GA6YQ/1

    – Wiktor Stribiżew
    Mar 22 at 18:27

















1















I have a string that the following structure:



ABCD123456EFGHIJ78 but sometimes it's missing a number or a character like:



ABC123456EFGHIJ78 or
ABCD123456E or
ABCD12345EFGHIJ78
etc.



That's why I need regular expressions.



What I want to extract is the first letter of the third group, in this case 'E'.



I have the following regex:



(D+)+(d+)+(D1)3


but I don't get the letter E.










share|improve this question

















  • 2





    See regex101.com/r/5GA6YQ/1

    – Wiktor Stribiżew
    Mar 22 at 18:27













1












1








1


0






I have a string that the following structure:



ABCD123456EFGHIJ78 but sometimes it's missing a number or a character like:



ABC123456EFGHIJ78 or
ABCD123456E or
ABCD12345EFGHIJ78
etc.



That's why I need regular expressions.



What I want to extract is the first letter of the third group, in this case 'E'.



I have the following regex:



(D+)+(d+)+(D1)3


but I don't get the letter E.










share|improve this question














I have a string that the following structure:



ABCD123456EFGHIJ78 but sometimes it's missing a number or a character like:



ABC123456EFGHIJ78 or
ABCD123456E or
ABCD12345EFGHIJ78
etc.



That's why I need regular expressions.



What I want to extract is the first letter of the third group, in this case 'E'.



I have the following regex:



(D+)+(d+)+(D1)3


but I don't get the letter E.







regex






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 22 at 18:25









esgesg

255




255







  • 2





    See regex101.com/r/5GA6YQ/1

    – Wiktor Stribiżew
    Mar 22 at 18:27












  • 2





    See regex101.com/r/5GA6YQ/1

    – Wiktor Stribiżew
    Mar 22 at 18:27







2




2





See regex101.com/r/5GA6YQ/1

– Wiktor Stribiżew
Mar 22 at 18:27





See regex101.com/r/5GA6YQ/1

– Wiktor Stribiżew
Mar 22 at 18:27












2 Answers
2






active

oldest

votes


















2














This seems to work for the example cases you provided.



^(?:[A-Za-z]+)(?:d+)(.)


It assumes that the first group is only letters and that the second group is only digits.






share|improve this answer






























    0














    There's already a nice answer.



    But for the records, your initial proposal was very close to work. You just needed to say that the character matching the 3rd group can repeat several times by adding a star:



    ^(D+)(d+)(D1)3*


    The main weakness is that D matches any char except digits, so also spaces. Making it more robust leads us to explicit the range of chars accepted:



    ^([A-Za-z]+)(d+)([A-Za-z]1)3*


    It's much better, but my favourite uses w to match at the end of the pattern any non white character:



    ([A-Za-z]+)(d+)([A-Za-z]1)w*





    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%2f55305759%2fwhat-would-be-the-regex-expression-to-get-the-first-letter-after-a-group-of-char%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














      This seems to work for the example cases you provided.



      ^(?:[A-Za-z]+)(?:d+)(.)


      It assumes that the first group is only letters and that the second group is only digits.






      share|improve this answer



























        2














        This seems to work for the example cases you provided.



        ^(?:[A-Za-z]+)(?:d+)(.)


        It assumes that the first group is only letters and that the second group is only digits.






        share|improve this answer

























          2












          2








          2







          This seems to work for the example cases you provided.



          ^(?:[A-Za-z]+)(?:d+)(.)


          It assumes that the first group is only letters and that the second group is only digits.






          share|improve this answer













          This seems to work for the example cases you provided.



          ^(?:[A-Za-z]+)(?:d+)(.)


          It assumes that the first group is only letters and that the second group is only digits.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 22 at 18:46









          Russ BrownRuss Brown

          1516




          1516























              0














              There's already a nice answer.



              But for the records, your initial proposal was very close to work. You just needed to say that the character matching the 3rd group can repeat several times by adding a star:



              ^(D+)(d+)(D1)3*


              The main weakness is that D matches any char except digits, so also spaces. Making it more robust leads us to explicit the range of chars accepted:



              ^([A-Za-z]+)(d+)([A-Za-z]1)3*


              It's much better, but my favourite uses w to match at the end of the pattern any non white character:



              ([A-Za-z]+)(d+)([A-Za-z]1)w*





              share|improve this answer



























                0














                There's already a nice answer.



                But for the records, your initial proposal was very close to work. You just needed to say that the character matching the 3rd group can repeat several times by adding a star:



                ^(D+)(d+)(D1)3*


                The main weakness is that D matches any char except digits, so also spaces. Making it more robust leads us to explicit the range of chars accepted:



                ^([A-Za-z]+)(d+)([A-Za-z]1)3*


                It's much better, but my favourite uses w to match at the end of the pattern any non white character:



                ([A-Za-z]+)(d+)([A-Za-z]1)w*





                share|improve this answer

























                  0












                  0








                  0







                  There's already a nice answer.



                  But for the records, your initial proposal was very close to work. You just needed to say that the character matching the 3rd group can repeat several times by adding a star:



                  ^(D+)(d+)(D1)3*


                  The main weakness is that D matches any char except digits, so also spaces. Making it more robust leads us to explicit the range of chars accepted:



                  ^([A-Za-z]+)(d+)([A-Za-z]1)3*


                  It's much better, but my favourite uses w to match at the end of the pattern any non white character:



                  ([A-Za-z]+)(d+)([A-Za-z]1)w*





                  share|improve this answer













                  There's already a nice answer.



                  But for the records, your initial proposal was very close to work. You just needed to say that the character matching the 3rd group can repeat several times by adding a star:



                  ^(D+)(d+)(D1)3*


                  The main weakness is that D matches any char except digits, so also spaces. Making it more robust leads us to explicit the range of chars accepted:



                  ^([A-Za-z]+)(d+)([A-Za-z]1)3*


                  It's much better, but my favourite uses w to match at the end of the pattern any non white character:



                  ([A-Za-z]+)(d+)([A-Za-z]1)w*






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 24 at 22:50









                  ChristopheChristophe

                  43.3k43883




                  43.3k43883



























                      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%2f55305759%2fwhat-would-be-the-regex-expression-to-get-the-first-letter-after-a-group-of-char%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