I want to write regex for django's model's charField. That regex contains all letters and last character contains "/".
Eg: "sequences/"
I return regex as follows,
Model.objects.filter(location_path__iregex=r'^[a-zA-Z]/$')
It is not showing filter data. demo data for location_path is ['sequences/', 'abc/xyz/', 'abc/aaaa/aaa', 'pqr/']
I want to filter data like 'sequences/', 'pqr/' which contains any character from a-z and field end with '/'
Please give me the proper regex pattern and syntax
You need to add +
after the character class, so that it would match one or more letters,
r'^[a-zA-Z]+/$'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With