0

I'm currently trying to come up with a regular expression that matches the following chunks.

A few examples:

07280969963593626387L
113843230015664032748F

In other words, I'm looking for any string which contains 20 or 21 digits and ending with a capital letter.

I'm very new to this, please help.

Nikita Fedyashev
  • 15,938
  • 11
  • 41
  • 69
Packy
  • 11
  • 1
  • 4
    I doubt this is what you want, but here you go :) `07280969963593626387L` - take a look at https://stackoverflow.com/tags/regex/info – ctwheels Oct 14 '20 at 21:19
  • Okay, after your edit: `(07280969963593626387L|113843230015664032748F)`. You haven't specified your pattern clearly enough, and once you do, the linked duplicates should become helpful. – Chris Oct 14 '20 at 21:42
  • Thanks , I just show 2 examples for the string . I found some regex :^\d{21}[A-Z]$,is it right or not? – Packy Oct 14 '20 at 21:57
  • @Packy, _we **don't know**_. You need to _clearly define what should match, and what should not_. Are you looking for any string that contains 21 digits and then a capital letter? You haven't said that anywhere. Please read [ask]. – Chris Oct 14 '20 at 23:36
  • @Nikita Fedyashev thanks – Packy Oct 14 '20 at 23:39
  • @Chris yes,I'm looking for any string which contains 20 or 21 digits and ending with a capital letter – Packy Oct 14 '20 at 23:43
  • 1
    Then you need to _say that in your question_. Where did the 20 digits come from? Your proposed regex specifies 21. Please read [ask]. – Chris Oct 15 '20 at 00:03
  • @Chris finally,I got it ,[0-9]{20,21}[A-Z],Thanks – Packy Oct 15 '20 at 00:46

0 Answers0