07-15-2019, 01:02 PM | #1 |
Junior Member
Posts: 8
Karma: 10
Join Date: May 2011
Location: Stockholm
Device: TrekStor Pyrus mini
|
reg.expr: how to detect the whole line?
Hi!
i have this sort of header on every page: <p class="calibre1"> BAD WRITING AND HOWTO FIX IT</p> So i need to detect a line where all the characters are capital letters and there's always more than one word. I also need to make sure that the script wouldn't delete similar strings inside of the text which is NOT header. Is there someone who could help me with it please? So far i've figured out how to detect strings of capital characters: [A-Z]{2,} and tried to use () to repeat the pattern search but just got all confused... |
07-15-2019, 01:47 PM | #2 |
Well trained by Cats
Posts: 29,817
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
You only want lines with all Capitals (with space)?
I think this will work, but BE CAREFUL. it may grab titles CASE SENSITIVE ticked Code:
<p class=".+">(\s*[A-Z]){1,}</p>
|
Advert | |
|
07-15-2019, 06:23 PM | #3 |
Junior Member
Posts: 8
Karma: 10
Join Date: May 2011
Location: Stockholm
Device: TrekStor Pyrus mini
|
thanks!
It works almost perfectly, except: it detects this kind of lines: <p class="calibre1"> I</p> It detects lines with one word only. Can i somehow limit is to choose like where there's more than one word? And more than one character? Again, thanks a lot, i'll try to understand how it all works! |
07-15-2019, 07:57 PM | #4 | |
Well trained by Cats
Posts: 29,817
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
( a optional space (the * says 0 or more) )Upper case letters (The case sensitivity affects this) Repeat the pattern 1,to many times So make 2 changes Code:
<p class=".+">(\s*[A-Z][A-Z]){2,}</p> But this has the bad effect of missing ANY 1 letter word . You might run this one first, the run the original on MANUALLY as the number of hits should be greatly reduced. BTW I ASSUME, you are using the Editor, not trying to do this as part of a conversion |
|
07-15-2019, 10:45 PM | #5 |
Junior Member
Posts: 8
Karma: 10
Join Date: May 2011
Location: Stockholm
Device: TrekStor Pyrus mini
|
|
Advert | |
|
Tags |
regular expressions |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Title or Author Correction via Reg Ex?? | gsd2012 | Library Management | 10 | 07-09-2018 09:44 AM |
Help with Reg-ex of Course | pappabees61 | Library Management | 1 | 09-23-2017 09:34 PM |
Reg-ex help...? | ElMiko | Sigil | 11 | 12-06-2011 12:41 AM |
Adobe Reg problem on PE | Gremalkin | enTourage eDGe | 5 | 09-02-2011 03:01 PM |
Reg expression for importing | Debby | Library Management | 2 | 02-17-2011 11:20 AM |