diff options
| author | Richard M. Stallman | 2004-01-27 04:52:09 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2004-01-27 04:52:09 +0000 |
| commit | 5fbbc83b2b8aa7d2f13c72467b43c6c71d01f388 (patch) | |
| tree | 4af499a4fd12ec56a3a67fe239fbb1efc0ef329b | |
| parent | bdb6a22747fdfce5f869ce1c56ee9bf3ed5d33b8 (diff) | |
| download | emacs-5fbbc83b2b8aa7d2f13c72467b43c6c71d01f388.tar.gz emacs-5fbbc83b2b8aa7d2f13c72467b43c6c71d01f388.zip | |
(Freplace_match): Handle nonexistent back-references properly.
| -rw-r--r-- | src/search.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/search.c b/src/search.c index 020573b75a1..c60d68b9374 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -2366,13 +2366,21 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2366 | substart = search_regs.start[sub]; | 2366 | substart = search_regs.start[sub]; |
| 2367 | subend = search_regs.end[sub]; | 2367 | subend = search_regs.end[sub]; |
| 2368 | } | 2368 | } |
| 2369 | else if (c >= '1' && c <= '9' && c <= search_regs.num_regs + '0') | 2369 | else if (c >= '1' && c <= '9') |
| 2370 | { | 2370 | { |
| 2371 | if (search_regs.start[c - '0'] >= 0) | 2371 | if (search_regs.start[c - '0'] >= 0 |
| 2372 | && c <= search_regs.num_regs + '0') | ||
| 2372 | { | 2373 | { |
| 2373 | substart = search_regs.start[c - '0']; | 2374 | substart = search_regs.start[c - '0']; |
| 2374 | subend = search_regs.end[c - '0']; | 2375 | subend = search_regs.end[c - '0']; |
| 2375 | } | 2376 | } |
| 2377 | else | ||
| 2378 | { | ||
| 2379 | /* If that subexp did not match, | ||
| 2380 | replace \\N with nothing. */ | ||
| 2381 | substart = 0; | ||
| 2382 | subend = 0; | ||
| 2383 | } | ||
| 2376 | } | 2384 | } |
| 2377 | else if (c == '\\') | 2385 | else if (c == '\\') |
| 2378 | delbackslash = 1; | 2386 | delbackslash = 1; |