Regex for requests

Hello friends,

I have a small problem with a simple expression and it is the following: this would be, for example, my test chain: request 2019120000061K, for which I use the regular expression \b20\d{11}\w .

The problem is that if the reader does not detect spaces between the word and the numbers, it does not detect it, that is, for the test chain
request2019120000061K, the above pattern would not work.

How could the pattern be that, in addition to meeting the previous condition:
The first 2 digits are always 19 or 20 and
always ends in the character K.

Thank you all in advance!

PD. the pattern \d{13}K$ works, but how could I complete it so that the first 2 digits were 19 or 20? (The request always has the same structure: 13 digits+k)

Hi @mbercianop ,

Could you maybe try with the below regex :

(?<=request\s?)(19|20)\d{11}K$

image

Do It!!

I knew it wasn’t difficult, but today I’m already ko.

Thank you very much, supermanPunch

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.