Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

regular expression with prefix

I am trying to write a regular expression for validating characters

13 characters and the first 5 starts must be ABCDE

for example

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  • ABCDE12312345 – valid
  • ABCDE14512345 – valid
  • 1234145123454 – NOT valid because not start with ABCDE // first five charaters must be ABCED and in total 13 characters

I am tried google but no luck

>Solution :

how about that:

r"^ABCDE.{8}$"
  • ^ start of string
  • followed by ABCDE
  • .{8} .` matches anything exact 8 times to get you to a length of 13
  • $ end of string

see here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading