Regex Expression for finding particular number

Hi Everyone,

I am stuck in one issue in regex.

I have one string

  1. AB# 33805717- 00 R/E FROM NA#52198052- 00
    SOS 032122 TO 032122, TOTAL BILLED $2
    OA FILMED UFE: 920220831200900
    FILM NUMBER: VRG40947802 REC DATE: 070222

I have to find the 11 digit number VRG40947802 , this can be 15 digit also some times.

I have used regex : “(\d{11,15}|[D]\d{11,15})” working fine on this one , but failing on other string.

  1. FILM NUMBER AGILE:19517960 FSRECVDATE 062722
    DIV ATL AUDIT NUMBER 44523104
    FILM NUMBER: ATL34910475, DDE AGILE ID: 19517960,
    ROD NUMBER: 44523104, DIV: ATL,
    RCVD DATE: 06/27/2022

In this i have to get ATL34910475, but isMatches activity is giving false .

Can anyone guide me on this.

for 1st one are you getting 920220831200900 or VRG40947802 ?
because the regex is matching 920220831200900

Just checked the same, it is taking 920220831200900, not sure where i am wrong in regex but i need VRG40947802

1 Like

can you try below pattern
"FILM NUMBER: ([a-zA-Z0-9,]{11,15}?)"

try this @Sahil_Garg1

([A-Z]{3}[\d]{8})

image

yup it is working let me test this one, also can u please guide me how u r making these, like i tried but never reached to correct regex

Hi,

I checked both one, one issue is there

suppose str = ATL34910888475 is present , which is not valid still it is matching
till ATL34910888

if you trying to find the film number then please use complete pattern which is
FILM NUMBER: ([a-zA-Z0-9,]{11,15}?)

FILM number is not fixed , this can be different also , we need to find string only

Try this:

System.Text.RegularExpressions.Regex.Match(InputVar,"[A-Z]{3}\d{8,15}").ToString

Reference:

System.Text.RegularExpressions.Regex.Match(InputVar,"(?<=FILM NUMBER: ).[A-Z].\d+").ToString

Reference:

Regards,
NaNi

then try this
([a-zA-Z]{2,4}[0-9,]{8,15}?)

because previous one might not work properly

Mate,

Again same is matching wrong, we need to match exact 11/15 character if present.

Some different string of same is type is making this regex fail

try this…
([a-zA-Z]{3}[0-9,]{8,12}?)

If possible give us more examples to test

refer below to tweak it further if required

1 Like

Mate,

I will do bit test of these regex, will reach again on forum if issue not resolved

1 Like

Yes… it would definitely going to help to build your regex knowledge
and remember to go through the explanation on right side (if you are using regex101.com)

can you check for:


(?<=FILM NUMBER: )\w+\b

Or


(?<=: )\b[A-Z]+[\d]+\b

1 Like

Thanks peter and everyone .

(?<=: )\b[A-Z]+[\d]+\b is working little exact to required exp.

I dont think it is working as per your requirement…

Mate,

i tested same on different cases,

Basically : ABC is always fixed in the string and other character are always between length 11-15, so this regex is recognising ‘:’ and A-Z character which is always unique for this number string.

Addition : if lenght is > 15 , then it’s input error, not the BOT level error which i discussed, but this regex is also not dynamic , it is static, i will see for some solid also.

hi everyone, I have similar issue.
Hi, I’m trying to find the number that is available after the “-”. For example in the below lists, i need only the numbers that are after “-”.

For example in this “S18NNE013 - 040 FC” in need only number 40.
and in this “21-0438 - 043 (DP Converted)” i need only number 43.

I tried to use this regex \s[-^\d]\w{2} and with this I’m able to select space, 0 and the number, but i just need number. Can anyone help me to get the required result.
image