Regular Expression for different numbers

These are the sample number . I have to write a regular expression for all of these samples.

It will be very helpful if you give any suggestions or ideas.

5319/21-22

3312230525

MM/21-22/1588

G190/21-22

SPC/2021/42

MSE/21-22/762

169

S121Y-00998

117/21-22/G

45

GT/21-22/0368

L82100160/2

IN1221021672

AMMPL/0292/21-22

MTL/M/224

ES/KOL1898/21-22

353/21-22

GT/21-22/0367

L82100160/11

PEC/INV/12/21-22

AJT/014/21-22

MISC/21-22/14

JSOC/21-22/253

GST/2021-22/509

PEW/18/21-22

MEW/CI/21-22/244

CN/159/21-22

EX-1523

GT-558

Regards,

Nirmalya Sarkar.

Hi @nirmalya.sarkar

Try this expression

[A-Z0-9\/\-]+

http://regexstorm.net/tester?p=[A-Z0-9\%2F\-]%2B&i=5319%2F21-22 3312230525 MM%2F21-22%2F1588 G190%2F21-22 SPC%2F2021%2F42 MSE%2F21-22%2F762 169 S121Y-00998 117%2F21-22%2FG 45 GT%2F21-22%2F0368 L82100160%2F2 IN1221021672 AMMPL%2F0292%2F21-22 MTL%2FM%2F224 ES%2FKOL1898%2F21-22 353%2F21-22 GT%2F21-22%2F0367 L82100160%2F11 PEC%2FINV%2F12%2F21-22 AJT%2F014%2F21-22 MISC%2F21-22%2F14 JSOC%2F21-22%2F253 GST%2F2021-22%2F509 PEW%2F18%2F21-22 MEW%2FCI%2F21-22%2F244 CN%2F159%2F21-22 EX-1523 GT-558

Hi @nirmalya.sarkar

Just give a try

Hope it will works

Hi,

FYI, another pattern :

\S+

expression

mc = System.Text.RegularExpressions.Regex.Matches(yourString,"\S+")

Regards,

Hi… below expression also works…do try…
[\D\d]+

@kumar.varun2 , Can you explain [A-Z0-9] part? What actually happens after writing this command?

Regards,
Nirmalya Sarkar.

@nirmalya.sarkar

It will capture All uppercase letter ie. A to Z and 0-9 is for all digits 0 to 9

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