Skip to content
Fast multiple string replacement
C Python
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
tests
.gitignore
README
array_lookup.c
array_lookup.h
dynstring.c
dynstring.h
makefile
radixtrie.c
stream.txt
testfile.txt
whiplace.c
whiplace.h
whiplace.py
whiplacemodule.c

README

Whiplace performs fast stream multiple replacement.
Get the source code and history from github.com.

Getting started:

git clone git@github.com:gui11aume/whiplace.git
cd whiplace
make
./whiplace
./whiplace tests/keytest.txt tests/targetest.txt


The key file must consist of one key-value pair per line,
separated by a tab. Subsequent tabs, if any, will be part
of the value. Keys specify what to match, values what to
replace the match with. Specifying no value leads to
deletion of the key (and lines with no key are ignored).


Maximal match

If several keys match the same position, whiplace will
use the longest (actually largest in dictionary order).
For example, 'abc' and 'ab' are possible matches against
'abcd'. In that case, 'abc' will be used and not 'ab',
because the match is longer. So 'ab' is a match only when
not followed by 'c', like in 'abde'.


Match collisions

Note that in the previous example 'bcd' would not match
'abcd' because 'abc' matches before, masking those letters
from other possible matches.


Match protection

If you want the occurrences of 'abc' to be replaced but
not the occurrences of 'abcd', add a line to the key file
where both key and value are 'abcd'.
Something went wrong with that request. Please try again.