The CreatorCon Call for Content is officially open! Get started here.

Regex issue

tsoct
Tera Guru

I need the input to begin with 'IT' followed by 25 characters.

When I tested IT60X0542811101000000123456 for regex ^IT\[0-9A-Z]{25}$, no matches were detected.

What might be the reason?

 

1 ACCEPTED SOLUTION

Amit Verma
Kilo Patron
Kilo Patron

Hi @tsoct 

 

Can you please try with the below regex :

^IT[A-Z0-9]{25}$

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

View solution in original post

10 REPLIES 10

Hopefully this should work /^IT\d[0-9 A-Z]+.{0,25}$/g

 

Please mark this as helpful and accept it as a solution if this resolves your query.

Thanks,

Sujatha V.M.

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.

Thanks, but this accepts less than 25 too. It must be 25 exact characters

@tsoct  Please find my scenarios based on your inputs: 

 

You have mentioned it should hold 25 characters after the word "IT"

 

Syntax : /\d([^a-z]){25}$/g

Test String : IT12345678912345678912345678

Your Test String : IT60X0542811101000000123456 

 

Scenario 1 : Limit to 25 

Length is 25, so its matched

SujathaVM_0-1715314172745.png

 

Length is less than 25 so its not matched

SujathaVM_2-1715314349648.png

 

Scenario 2: Ignore Lowercase

By adding a uppercase character or digit, it matches the expression 

SujathaVM_4-1715314550663.png

 

SujathaVM_5-1715314601697.png

 

If its a lowercase, it doesn't match the expression

SujathaVM_6-1715314699019.png

 

Please try and let me know the results. Also modify accordingly to your need. 

 

Please mark this as helpful and accept it as a solution if this resolves your query.

Thanks,

Sujatha V.M.

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.

Kieran Anson
Kilo Patron

^IT.{25}$ assuming you want to allow any character (excluding line terminations)

It must be Uppercase and digits only. No special character allowed