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
Post a Comment