Regular Expression

ePub Magic TOC adopts standard Perl Regular Expression grammar.

Regular Expression will be applied to all TOC entries.

Please input the key word in the Replace box, and destination into With box.

Here's is a simple table of this grammar, for more details and examples please read some books about Regular Expression.

Regular Expression is very professional, please do it after you already mastered it.

Essential Grammar


Meta Characters
(X means any character here)
Key Description
^ start of line
$ end of line
. Anything except line feed
X* Preceding expression exists any times or not
X+ Preceding expression exists once or more
? Exists once or not
(XX) Make a group of characters, so that we can add other meta character behind or reference it in result
[XX]Make a class of characters, can match any characters inside.
(A|B) Similar as [AB], but A and B can be any length of characters, such as a word
|Either of two sides can match.
[^X]A class of all characters except the characters inside
{a}Preceding expression should be repeated a times.
{a,b}Preceding expression should be repeated from a times to b times.
X?Preceding expression exists once or not.
?Match only to the nearest expression followed
Escaped Characters
Key Abbr. of Description
\d Digit means a number
\b Boundary means a word boundary. (Some other types of RegEx use \< and \> do the same thing.)
\r Return means carriage return
\n Newlinemeans newline
\r\n whole line break
\w Wordwithout a + behind, it could only be a Latin character. Match a whole word should be \b\w+\b
\s Space means white space, blank character, invisible character.
\t Tab means white space, blank character, invisible character.
\W ... An upper case means the negative class of the lowercase one means, reversed range.