Quantcast
Channel: MobileRead Forums - Conversion
Viewing all articles
Browse latest Browse all 3900

How to make ebook-convert use multi-line mode regexp?

$
0
0
I want to use ^ and $ in regular expressions in ebook-convert, but it apparently doesn't operate in multi-line mode.

$ cat > sample.txt
abc def ghi
<ctrl-d>

$ ebook-convert.exe sample.txt sample2.txt --sr1-search "abc" --sr1-replace 'zzz'
Conversion options changed from defaults:
sr1_replace: u'zzz'
sr1_search: u'abc'
1% Converting input to HTML...
InputFormatPlugin: TXT Input running
on Z:\data\text\sci\physics\thermodynamics\sample.txt
Language not specified
Creator not specified
Building file list...
Normalizing filename cases
Rewriting HTML links
flow is too short, not running heuristics
Forcing index.html into XHTML namespace
34% Running transforms on e-book...
Merging user specified metadata...
Detecting structure...
Auto generated TOC with 0 entries.
Flattening CSS and remapping font sizes...
Source base font size is 12.00000pt
Removing fake margins...
Cleaning up manifest...
Trimming unused files from manifest...
Creating TXT Output...
67% Running TXT Output plugin
Converting XHTML to TXT...
TXT output written to Z:\scratch\sample2.txt
Output saved to Z:\scratch\sample2.txt

$ cat sample2.txt
zzz def ghi

$ ebook-convert.exe sample.txt sample2.txt --sr1-search "^abc" --sr1-replace 'zzz'
Conversion options changed from defaults:
sr1_replace: u'zzz'
sr1_search: u'^abc'
1% Converting input to HTML...
InputFormatPlugin: TXT Input running
on Z:\data\text\sci\physics\thermodynamics\sample.txt
Language not specified
Creator not specified
Building file list...
Normalizing filename cases
Rewriting HTML links
flow is too short, not running heuristics
Forcing index.html into XHTML namespace
34% Running transforms on e-book...
Merging user specified metadata...
Detecting structure...
Auto generated TOC with 0 entries.
Flattening CSS and remapping font sizes...
Source base font size is 12.00000pt
Removing fake margins...
Cleaning up manifest...
Trimming unused files from manifest...
Creating TXT Output...
67% Running TXT Output plugin
Converting XHTML to TXT...
TXT output written to Z:\scratch\sample2.txt
Output saved to Z:\scratch\sample2.txt

$ cat sample2.txt
abc def ghi

Same result if I use --sr1-search "^abc" instead of --sr1-search '^abc'.

Viewing all articles
Browse latest Browse all 3900

Trending Articles