[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: RE newbie question
From: TUA <kai.peters () gmail ! com>
Date: 2018-04-18 19:37:29
Message-ID: beda311b-4f32-497c-9ab1-03c5fff3c02d () googlegroups ! com
[Download RAW message or body]
import re
compval = 'A123456_8'
regex = '[a-zA-Z]\w{0,7}'
if re.match(regex, compval):
print('Yes')
else:
print('No')
My intention is to implement a max. length of 8 for an input string. The above works \
well in all other respects, but does allow for strings that are too long.
What is the proper way to fix this?
Thanks for any help!
--
https://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic