Apply list of regex pattern on list python

The culprit is the first pattern from the list - r"^{53}". It reads: ^ - match the beginning of the string and then {53} repeat the previous character or group 53 times. Wait... but there is no other character than ^ which cannot be repeated! Indeed. Add a char that you want to match 53 repetitions of. Or, escape the sequence {53} if you want to match it verbatim, e.g. using re.escape.


^{53} is not a valid regular expression, since the repeater {53} must be preceded by a character or a pattern that can be repeated. If you mean to make it validate a string that is at least 53 characters long you can use the following pattern instead:

^.{53}

Tags:

Python

List

Regex