regex - How to search for alphanumeric substring of specific length in Python? -


say have string "ldhjshjds hdajhdshj4 hdsshj4 kdskjdshjdsjds"

i want search substrings (alphanumeric only) starting "h", if string between 10-20 characters.

"hdajhdshj4" match. "hdsshj4" not.

would such regex costly on cpu cycles?

r"\bh[a-za-z0-9]{9,19}\b" looks precisely that.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -