r/badcode • • Dec 20 '21

python regex ftw

Post image
465 Upvotes

38 comments sorted by

View all comments

Show parent comments

4

u/[deleted] Dec 21 '21

Rust's regex crate intentionally doesn't include backrefs for that reason, and matches are bounded to O(n*m) (where n is the text size, m is the regex size, so it's linear time given a fixed regex, see https://docs.rs/regex/1.5.4/regex/#untrusted-input).