Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 06-10-2013, 11:28 PM   #1
Hoods7070
Zealot
Hoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notes
 
Posts: 137
Karma: 24430
Join Date: Mar 2012
Location: Australia
Device: Nexus 7"
Help with Regex - find groups of words in uppercase

I want to be able to find groups of text all in uppercase (and any punctuation etc. in those groups) in my books then span the groups with a style. e.g. Find THE CAT SAT, ON THE-MAT, Replace same string with a span of Style tags around it.

I can easily single uppercase words, but I have no idea how to extend that search to include more than one word. Any help with that, and the code for the Replace would be greatly appreciated.
Hoods7070 is offline   Reply With Quote
Old 06-10-2013, 11:54 PM   #2
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 15,054
Karma: 5936659
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by Hoods7070 View Post
I want to be able to find groups of text all in uppercase (and any punctuation etc. in those groups) in my books then span the groups with a style. e.g. Find THE CAT SAT, ON THE-MAT, Replace same string with a span of Style tags around it.

I can easily single uppercase words, but I have no idea how to extend that search to include more than one word. Any help with that, and the code for the Replace would be greatly appreciated.
I used this search for an all CAPs new scene detect
Code:
<p>(.([A-Z]| ){4,10})
your search wants to detect a minimum count of CAPS (say {3,} ), followed by a space, repeated at least {4,} times
the trailing comma in the range says or more if you don't want a finite cap.
theducks is offline   Reply With Quote
Old 06-11-2013, 08:02 AM   #3
Hoods7070
Zealot
Hoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notesHoods7070 can name that song in three notes
 
Posts: 137
Karma: 24430
Join Date: Mar 2012
Location: Australia
Device: Nexus 7"
Thanks, Ducks, that works to a degree, minus the <p> tag. I removed the <p> tag and added a space before ( .([A-Z) and that works well enough to find groups. Unfortunately it also finds single words all in uppercase (e.g. the all caps stuff in the !DOCTYPE codes at the top of each page) but I can live with that.

Cheers
Hoods7070 is offline   Reply With Quote
Old 06-11-2013, 09:41 AM   #4
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 15,054
Karma: 5936659
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by Hoods7070 View Post
Thanks, Ducks, that works to a degree, minus the <p> tag. I removed the <p> tag and added a space before ( .([A-Z) and that works well enough to find groups. Unfortunately it also finds single words all in uppercase (e.g. the all caps stuff in the !DOCTYPE codes at the top of each page) but I can live with that.

Cheers
That is why the <p was there (it did need some fine tuning to closer match your usage style) These are kickstart tips, not absolutes, you are expected to season to taste


Code:
<p.*>(.([A-Z]| ){4,10})
might work better IF you code uses P and not DIV <--see! Why season to taste is needed
theducks is offline   Reply With Quote
Reply

Tags
regex

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex find and replace SanatyrZeo Sigil 5 10-29-2012 08:03 AM
Help with regex expression for words in all caps bfollowell Sigil 9 01-20-2012 06:11 PM
RegEx find and replace iblesq Sigil 1 01-10-2011 10:26 PM
regex to fix up hyphenated words please cybmole Sigil 2 01-06-2011 05:13 AM
REGEX find and replace help please potestus Sigil 13 09-18-2010 05:14 PM


All times are GMT -4. The time now is 07:17 AM.


MobileRead.com is a privately owned, operated and funded community.