1. A processor implemented method of modifying an input string of a regular language, the input string including at least two symbols, the method comprising: a) receiving the input string; b) applying the input string to a finite state data structure to obtain an output string that is a modified version of the input string in which a first substring in the input string is replaced by a second substring in the output string; the finite state data structure indicating a set of replaceable substrings that includes the first substring and indicating, for each replaceable substring, a replacement substring, the second substring being the replacement substring of the first substring; the input string being partitionable into any of two or more different substring series in accordance with the set of replaceable substrings; the finite state data structure partitioning the input string into a substring series that includes the first substring in accordance with a directionality constraint and a length constraint; the finite state data structure being derived to partition input strings only in accordance with the directionality constraint and the length constraint; the directionality constraint requiring partition of the input string as if the set of replaceable substrings were compared with the input string by one of from-left-to-right and from-right-to-left; and the length constraint requiring partition of the input string as if, where two or more of the set of replaceable substrings could be matched, one of the matching replaceable substrings was selected for replacement, the selected substring being the longest or the shortest; and c) providing the output string as output.