summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorChristopher Smith <chris@jalakai.co.uk>2015-05-29 16:52:05 +0100
committerChristopher Smith <chris@jalakai.co.uk>2015-05-29 16:52:05 +0100
commit3dfe7d64760baa568018c1d6d311c26d1a2da098 (patch)
tree60bdca1cd70a14b4ec8fec689c2b9771683ff70a /inc
parent4b8290f563ad5ac84dd92fb8ca97ba5970c472b3 (diff)
downloadrpg-3dfe7d64760baa568018c1d6d311c26d1a2da098.tar.gz
rpg-3dfe7d64760baa568018c1d6d311c26d1a2da098.tar.bz2
add anchors when constructing pattern from a non-regex oldline
Diffstat (limited to 'inc')
-rw-r--r--inc/io.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/inc/io.php b/inc/io.php
index 51ca2ea14..c559feb17 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -312,7 +312,7 @@ function io_replaceInFile($file, $oldline, $newline, $regex=false, $maxlines=0)
}
// make non-regexes into regexes
- $pattern = $regex ? $oldline : '/'.preg_quote($oldline,'/').'/';
+ $pattern = $regex ? $oldline : '/^'.preg_quote($oldline,'/').'$/';
$replace = $regex ? $newline : addcslashes($newline, '\$');
// remove matching lines