![]() |
#1 |
Jr. - Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 586
Karma: 2000358
Join Date: Aug 2010
Location: Alabama
Device: Archos, Asus, HP, Lenovo, Nexus and Samsung tablets in 7,8 and 10"
|
Regex F&R problem?
I had noticed in the past that the regex count and replace numbers didn't always match and decided to look into it.
The reason for this disparity is that the count notes each instance of the regex match while the replace function replaces only the first match in any given paragraph. Ergo, the count difference. This is not true for a "normal" F&R. No big problem if you are aware of this anomaly. Just re-run the F&R until none are replaced. I hope this isn't old hat but I haven't seen anything on it and a search didn't turn up anything. Regards - John |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,680
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
|
It's possible that the regular expression that you used caused the problem and not Sigil. Can you give us examples of specific regular search expressions that you used and the texts that you used it with?
|
![]() |
![]() |
![]() |
#3 |
Jr. - Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 586
Karma: 2000358
Join Date: Aug 2010
Location: Alabama
Device: Archos, Asus, HP, Lenovo, Nexus and Samsung tablets in 7,8 and 10"
|
|
![]() |
![]() |
![]() |
#4 |
Jr. - Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 586
Karma: 2000358
Join Date: Aug 2010
Location: Alabama
Device: Archos, Asus, HP, Lenovo, Nexus and Samsung tablets in 7,8 and 10"
|
More F&R info
First things first. This is an amended version the first paragraph of my original post which should read:
I had noticed in the past that the normal count and regex count numbers didn't always match and decided to look into it. Using the attached file, count the number of calibre9 and you will get of 120. The same with <em class="calibre9">. Using the regex terms below you will get a count and a replace count of 90. Code:
<em class="calibre9">(.*)</em> <span class="italic">\1</span> Go to line 102 of chapter 12 and you will find five instances of the terms in question. The first two have been changed the remaining three remain the same. Regards - John |
![]() |
![]() |
![]() |
#5 |
Sigil developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,274
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
|
Try:
Find: Code:
<em class="calibre9">(.*?)</em> Code:
(?U)<em class="calibre9">(.*)</em> |
![]() |
![]() |
![]() |
#6 |
Jr. - Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 586
Karma: 2000358
Join Date: Aug 2010
Location: Alabama
Device: Archos, Asus, HP, Lenovo, Nexus and Samsung tablets in 7,8 and 10"
|
|
![]() |
![]() |
![]() |
#7 |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Jabbers:
FWIW--I believe that's actually Amish. I could be misremembering--those ol' brain cells aren't firing on all the cylinders as they did when erewhile I was young; but, I think that's right. ;-) Hitch |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Regex: File Renaming Pre-Import & Importing | penguinaka | Library Management | 20 | 08-14-2012 06:11 PM |
RegEx & Unicode | capnm | Library Management | 14 | 12-01-2011 08:23 PM |
Search & Replace/Regex help!! | millertime13 | Conversion | 4 | 07-22-2011 02:40 AM |
Regex Problem | huebi | Sigil | 3 | 05-10-2011 04:32 AM |
CSS & regex for chapter titles | hpstricker | Calibre | 3 | 07-17-2008 10:13 AM |