You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The regex is actually not faster, for different reasons. I'm not sure what regexp-tree optimizes for (fastest runtime or smallest regex), so ymmv if or what action you'd want to take. In any case, I want to avoid duplicate work while investigation :)
kurtextrem
changed the title
regexp-tree does not optimize (\.(?!$)|$)) to \.?\b
regexp-tree does not optimize (\.(?!$)|$))Oct 21, 2023
kurtextrem
changed the title
regexp-tree does not optimize (\.(?!$)|$))
regexp-tree does not optimize (\.(?!$)|$))$Oct 21, 2023
Coming from this SO post: https://stackoverflow.com/a/36760050
The regex
^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$
got optimized (by hand) to:
^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$
so,
partbefore(\.(?!$)|$))$
can be expressed as(partbefore\.?\b)$
, avoiding the negative look-ahead, making the regex smaller.Maybe worth adding as optimization?
The text was updated successfully, but these errors were encountered: