Skip to content

Commit 7db0fb3

Browse files
committed
replace strings index fix
allow replace strings with adjacent text like "$1ies" "$1s"
1 parent 93f3798 commit 7db0fb3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/re.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ impl<'t> Captures<'t> {
780780
pub fn expand(&self, text: &str) -> String {
781781
// How evil can you get?
782782
// FIXME: Don't use regexes for this. It's completely unnecessary.
783-
let re = Regex::new(r"(^|[^$]|\b)\$(\w+)").unwrap();
783+
let re = Regex::new(r"(^|[^$]|\b)\$(\d+|\w+)").unwrap();
784784
let text = re.replace_all(text, |refs: &Captures| -> String {
785785
let pre = refs.at(1).unwrap_or("");
786786
let name = refs.at(2).unwrap_or("");

0 commit comments

Comments
 (0)