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 regular express ((IMG|CAM|MG|MB2)_|(DSCN|CIMG))(?P<n>[0-9]+)$ is a match on the text "CIMG2341" but expected result of regex.replace("CIMG2341", "$n") returns "2341" is not found, instead "CIMG2341" is returned. The correct behavior is observer when the original regex is replaced with ((MG|MB2)_|(DSCN|CIMG))(?P<n>[0-9]+)$.
externcrate regex;use regex::{Regex};fnmain(){let text = "CIMG2341";let regex = Regex::new("((IMG|CAM|MG|MB2)_|(DSCN|CIMG))(?P<n>[0-9]+)$").unwrap();assert!(regex.is_match(text));// This works (no panic)let renamed = regex.replace(text,"$n");assert_eq!(renamed,"2341");// This panics}
The text was updated successfully, but these errors were encountered:
The regular express
((IMG|CAM|MG|MB2)_|(DSCN|CIMG))(?P<n>[0-9]+)$
is a match on the text"CIMG2341"
but expected result ofregex.replace("CIMG2341", "$n")
returns"2341"
is not found, instead"CIMG2341"
is returned. The correct behavior is observer when the original regex is replaced with((MG|MB2)_|(DSCN|CIMG))(?P<n>[0-9]+)$
.The text was updated successfully, but these errors were encountered: