RegEx for ISIN with at least 1 number












2















I have the following RegEx to parse ISIN of fonds, assets, etc.. (2 characters followed by 10 digits and characters)



([A-Z]{2})([A-Z0-9]{10})


But this also marks for example a word like this ABCDEFGHIJKL, but this is no real ISIN. A definition of ISINs is here: WIKI



So some examples are US45256BAD38, US64118Q1076, XS0884410019. What would be the correct RegEx to search for them, without matches like ABCDEFGHIJKL?



Maybe with a RegEx to have at least one number?










share|improve this question



























    2















    I have the following RegEx to parse ISIN of fonds, assets, etc.. (2 characters followed by 10 digits and characters)



    ([A-Z]{2})([A-Z0-9]{10})


    But this also marks for example a word like this ABCDEFGHIJKL, but this is no real ISIN. A definition of ISINs is here: WIKI



    So some examples are US45256BAD38, US64118Q1076, XS0884410019. What would be the correct RegEx to search for them, without matches like ABCDEFGHIJKL?



    Maybe with a RegEx to have at least one number?










    share|improve this question

























      2












      2








      2








      I have the following RegEx to parse ISIN of fonds, assets, etc.. (2 characters followed by 10 digits and characters)



      ([A-Z]{2})([A-Z0-9]{10})


      But this also marks for example a word like this ABCDEFGHIJKL, but this is no real ISIN. A definition of ISINs is here: WIKI



      So some examples are US45256BAD38, US64118Q1076, XS0884410019. What would be the correct RegEx to search for them, without matches like ABCDEFGHIJKL?



      Maybe with a RegEx to have at least one number?










      share|improve this question














      I have the following RegEx to parse ISIN of fonds, assets, etc.. (2 characters followed by 10 digits and characters)



      ([A-Z]{2})([A-Z0-9]{10})


      But this also marks for example a word like this ABCDEFGHIJKL, but this is no real ISIN. A definition of ISINs is here: WIKI



      So some examples are US45256BAD38, US64118Q1076, XS0884410019. What would be the correct RegEx to search for them, without matches like ABCDEFGHIJKL?



      Maybe with a RegEx to have at least one number?







      regex






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 16 '15 at 7:23









      ZerOneZerOne

      77731028




      77731028
























          2 Answers
          2






          active

          oldest

          votes


















          0














          You can use a lookahead regex:



          b([A-Z]{2})((?![A-Z]{10}b)[A-Z0-9]{10})b


          RegEx Demo



          (?![A-Z]{10}b) is a negative lookahead that will fail the match if all 10 chars are letters after first 2 chars.






          share|improve this answer
























          • Thanks! This works fine in the demo, but I use it in PLSQL with REGEXP_SUBSTR and there it fails.. do you know if REGEXP_SUBSTR does not support lookaheads?

            – ZerOne
            Oct 16 '15 at 8:15











          • Hmm you didn't mention this in question. I'm not sure if Oracle regex supports lookahead. Check documentation.

            – anubhava
            Oct 16 '15 at 8:36






          • 1





            Yes I thought that this would be no problem for Oracle, but in fact Oracle doesn't support lookahead and lookbehind. You answered my question so thanks! I just asked the wrong question

            – ZerOne
            Oct 16 '15 at 10:03



















          5














          If you can not use lookahead according to the Wikipedia defintion you can also just check if the last character is a number as it should be the check digit.




          ISINs consist of two alphabetic characters, which are the ISO 3166-1 alpha-2 code for the issuing country, nine alpha-numeric characters (the National Securities Identifying Number, or NSIN, which identifies the security, padded as necessary with leading zeros), and one numerical check digit.




          Source: https://en.wikipedia.org/wiki/International_Securities_Identification_Number#Description



          Meaning this also could work:



          ([A-Z]{2})([A-Z0-9]{9})([0-9]{1})





          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%2f33164718%2fregex-for-isin-with-at-least-1-number%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














            You can use a lookahead regex:



            b([A-Z]{2})((?![A-Z]{10}b)[A-Z0-9]{10})b


            RegEx Demo



            (?![A-Z]{10}b) is a negative lookahead that will fail the match if all 10 chars are letters after first 2 chars.






            share|improve this answer
























            • Thanks! This works fine in the demo, but I use it in PLSQL with REGEXP_SUBSTR and there it fails.. do you know if REGEXP_SUBSTR does not support lookaheads?

              – ZerOne
              Oct 16 '15 at 8:15











            • Hmm you didn't mention this in question. I'm not sure if Oracle regex supports lookahead. Check documentation.

              – anubhava
              Oct 16 '15 at 8:36






            • 1





              Yes I thought that this would be no problem for Oracle, but in fact Oracle doesn't support lookahead and lookbehind. You answered my question so thanks! I just asked the wrong question

              – ZerOne
              Oct 16 '15 at 10:03
















            0














            You can use a lookahead regex:



            b([A-Z]{2})((?![A-Z]{10}b)[A-Z0-9]{10})b


            RegEx Demo



            (?![A-Z]{10}b) is a negative lookahead that will fail the match if all 10 chars are letters after first 2 chars.






            share|improve this answer
























            • Thanks! This works fine in the demo, but I use it in PLSQL with REGEXP_SUBSTR and there it fails.. do you know if REGEXP_SUBSTR does not support lookaheads?

              – ZerOne
              Oct 16 '15 at 8:15











            • Hmm you didn't mention this in question. I'm not sure if Oracle regex supports lookahead. Check documentation.

              – anubhava
              Oct 16 '15 at 8:36






            • 1





              Yes I thought that this would be no problem for Oracle, but in fact Oracle doesn't support lookahead and lookbehind. You answered my question so thanks! I just asked the wrong question

              – ZerOne
              Oct 16 '15 at 10:03














            0












            0








            0







            You can use a lookahead regex:



            b([A-Z]{2})((?![A-Z]{10}b)[A-Z0-9]{10})b


            RegEx Demo



            (?![A-Z]{10}b) is a negative lookahead that will fail the match if all 10 chars are letters after first 2 chars.






            share|improve this answer













            You can use a lookahead regex:



            b([A-Z]{2})((?![A-Z]{10}b)[A-Z0-9]{10})b


            RegEx Demo



            (?![A-Z]{10}b) is a negative lookahead that will fail the match if all 10 chars are letters after first 2 chars.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Oct 16 '15 at 7:29









            anubhavaanubhava

            533k48331408




            533k48331408













            • Thanks! This works fine in the demo, but I use it in PLSQL with REGEXP_SUBSTR and there it fails.. do you know if REGEXP_SUBSTR does not support lookaheads?

              – ZerOne
              Oct 16 '15 at 8:15











            • Hmm you didn't mention this in question. I'm not sure if Oracle regex supports lookahead. Check documentation.

              – anubhava
              Oct 16 '15 at 8:36






            • 1





              Yes I thought that this would be no problem for Oracle, but in fact Oracle doesn't support lookahead and lookbehind. You answered my question so thanks! I just asked the wrong question

              – ZerOne
              Oct 16 '15 at 10:03



















            • Thanks! This works fine in the demo, but I use it in PLSQL with REGEXP_SUBSTR and there it fails.. do you know if REGEXP_SUBSTR does not support lookaheads?

              – ZerOne
              Oct 16 '15 at 8:15











            • Hmm you didn't mention this in question. I'm not sure if Oracle regex supports lookahead. Check documentation.

              – anubhava
              Oct 16 '15 at 8:36






            • 1





              Yes I thought that this would be no problem for Oracle, but in fact Oracle doesn't support lookahead and lookbehind. You answered my question so thanks! I just asked the wrong question

              – ZerOne
              Oct 16 '15 at 10:03

















            Thanks! This works fine in the demo, but I use it in PLSQL with REGEXP_SUBSTR and there it fails.. do you know if REGEXP_SUBSTR does not support lookaheads?

            – ZerOne
            Oct 16 '15 at 8:15





            Thanks! This works fine in the demo, but I use it in PLSQL with REGEXP_SUBSTR and there it fails.. do you know if REGEXP_SUBSTR does not support lookaheads?

            – ZerOne
            Oct 16 '15 at 8:15













            Hmm you didn't mention this in question. I'm not sure if Oracle regex supports lookahead. Check documentation.

            – anubhava
            Oct 16 '15 at 8:36





            Hmm you didn't mention this in question. I'm not sure if Oracle regex supports lookahead. Check documentation.

            – anubhava
            Oct 16 '15 at 8:36




            1




            1





            Yes I thought that this would be no problem for Oracle, but in fact Oracle doesn't support lookahead and lookbehind. You answered my question so thanks! I just asked the wrong question

            – ZerOne
            Oct 16 '15 at 10:03





            Yes I thought that this would be no problem for Oracle, but in fact Oracle doesn't support lookahead and lookbehind. You answered my question so thanks! I just asked the wrong question

            – ZerOne
            Oct 16 '15 at 10:03













            5














            If you can not use lookahead according to the Wikipedia defintion you can also just check if the last character is a number as it should be the check digit.




            ISINs consist of two alphabetic characters, which are the ISO 3166-1 alpha-2 code for the issuing country, nine alpha-numeric characters (the National Securities Identifying Number, or NSIN, which identifies the security, padded as necessary with leading zeros), and one numerical check digit.




            Source: https://en.wikipedia.org/wiki/International_Securities_Identification_Number#Description



            Meaning this also could work:



            ([A-Z]{2})([A-Z0-9]{9})([0-9]{1})





            share|improve this answer




























              5














              If you can not use lookahead according to the Wikipedia defintion you can also just check if the last character is a number as it should be the check digit.




              ISINs consist of two alphabetic characters, which are the ISO 3166-1 alpha-2 code for the issuing country, nine alpha-numeric characters (the National Securities Identifying Number, or NSIN, which identifies the security, padded as necessary with leading zeros), and one numerical check digit.




              Source: https://en.wikipedia.org/wiki/International_Securities_Identification_Number#Description



              Meaning this also could work:



              ([A-Z]{2})([A-Z0-9]{9})([0-9]{1})





              share|improve this answer


























                5












                5








                5







                If you can not use lookahead according to the Wikipedia defintion you can also just check if the last character is a number as it should be the check digit.




                ISINs consist of two alphabetic characters, which are the ISO 3166-1 alpha-2 code for the issuing country, nine alpha-numeric characters (the National Securities Identifying Number, or NSIN, which identifies the security, padded as necessary with leading zeros), and one numerical check digit.




                Source: https://en.wikipedia.org/wiki/International_Securities_Identification_Number#Description



                Meaning this also could work:



                ([A-Z]{2})([A-Z0-9]{9})([0-9]{1})





                share|improve this answer













                If you can not use lookahead according to the Wikipedia defintion you can also just check if the last character is a number as it should be the check digit.




                ISINs consist of two alphabetic characters, which are the ISO 3166-1 alpha-2 code for the issuing country, nine alpha-numeric characters (the National Securities Identifying Number, or NSIN, which identifies the security, padded as necessary with leading zeros), and one numerical check digit.




                Source: https://en.wikipedia.org/wiki/International_Securities_Identification_Number#Description



                Meaning this also could work:



                ([A-Z]{2})([A-Z0-9]{9})([0-9]{1})






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 21 '18 at 17:06









                J. PeterJ. Peter

                5112




                5112






























                    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%2f33164718%2fregex-for-isin-with-at-least-1-number%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

                    鏡平學校

                    ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

                    Why https connections are so slow when debugging (stepping over) in Java?