How to write repeatation fromat in python using regular expression i am a new to regular expression in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to write repeatation fromat in python using regular expression i am a new to regular expression in python

I have written this format in JavaScript var pattern=/^[1-4][A-Z]{2}$/ as I can write 2 characters from A-Z how to achieve this format in python

19th Aug 2018, 9:57 AM
Ashraf ali
Ashraf ali - avatar
1 Answer
+ 1
import re x = '3AH' a = re.findall(r"^[1-4][A-Z]{2}
quot;,x) print(a)
19th Aug 2018, 1:19 PM
Russ
Russ - avatar