summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Lehtimäki <matti.lehtimaki@gmail.com>2012-09-17 19:21:38 +0300
committerMatti Lehtimäki <matti.lehtimaki@gmail.com>2012-09-17 19:21:38 +0300
commit792857f38c02ad2f8c7be52803f00f03304d564e (patch)
tree86332084a5c014a9378b6a52bd458bccad42bb33
parent823ced0e58385c959dc9de8a4621004f6e2d5ce0 (diff)
downloadvdr-plugin-epgfixer-792857f38c02ad2f8c7be52803f00f03304d564e.tar.gz
vdr-plugin-epgfixer-792857f38c02ad2f8c7be52803f00f03304d564e.tar.bz2
Fix replacing with empty string at the beginning of a string when using s///.
-rw-r--r--regexp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/regexp.c b/regexp.c
index 919923d..e0529d3 100644
--- a/regexp.c
+++ b/regexp.c
@@ -129,6 +129,8 @@ void cRegexp::ParseRegexp(char *restring)
regexp = strdup(&restring[2]);
if (*(p+1) != '/') //
replacement = strdup(p+1);
+ else
+ replacement = strdup("");
break;
}
}
@@ -232,7 +234,7 @@ bool cRegexp::Apply(cEvent *Event)
start_offset = ovector[1];
}
// replace EPG field if regexp matched
- if (**resultstring && (last_match_end < tmpstringlen-1)) {
+ if (last_match_end > 0 && (last_match_end < tmpstringlen-1)) {
resultstring = cString::sprintf("%s%s", *resultstring, tmpstring+last_match_end);
switch (source) {
case REGEXP_TITLE: