![]() |
#1 |
Nameless Being
|
Replace truncating found text
Using this search: <p><b>([A-Z]+\s[A-Z]+)+</b></p>
the following string was found and the entire string was highlighted <p><b>MEDICATIONS THAT CAUSE WEIGHT GAIN</b></p> but applying this replace: <h4>\1</h4> I got the following truncated result <h4>T GAIN</h4> What I was hoping to do was to find all occurrences of <p><b>ONLY WORDS IN CAPS</b></p>, regardless of the number of words and replace it with <h4>ONLY WORDS IN CAPS</h4>. Looking to capture strings of two or more words. |
![]() |
![]() |
#2 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,451
Karma: 167726581
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Code:
<p><b>([A-Z\s]+)+</b></p> |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
I'm pretty sure that extra plus sign is culprit. So:
Code:
<p><b>([A-Z\s]+)</b></p> Code:
<p><b>(.+?)</b></p> Or maybe: Code:
<p><b>(.+\w)</b></p> Disclaimer: These are completely untested. |
![]() |
![]() |
![]() |
#4 |
Nameless Being
|
Thanks guys for the ideas.
I'll try them out. My reason for not using <p><b>(.+?)</b></p> or <p><b>(.+\w)</b></p> was that I needed to catch only capitalized words. |
![]() |
![]() |
#5 |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,581
Karma: 14328510
Join Date: Nov 2019
Device: none
|
This seems to work for me in Sigil:
Code:
<p><b>([[:upper:]+[:blank:]]+)</b></p> Code:
<p><b>([[A-Z]+[ \t]]+)</b></p> Last edited by hobnail; 07-30-2020 at 04:34 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,451
Karma: 167726581
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
I'm beginning to get the feeling that this thread has devolved into how many different regexes will give the same result.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Search and replace returns entire field when no match is found | wladdy | Calibre | 2 | 02-16-2014 01:51 AM |
Search-and-Replace with a found number | Lamen | Conversion | 6 | 11-02-2012 08:51 PM |
HTML tables truncating after converting to epub | SEI Publications | Conversion | 7 | 05-06-2011 06:53 PM |
I finally found a device to replace my Palm PDA | Nate the great | Alternative Devices | 50 | 12-10-2008 04:32 PM |
I found way to vastly improve displaying of text! | Malder1 | iRex | 43 | 01-05-2007 05:32 PM |