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 01-02-2013, 10:37 PM   #1
phossler
Addict
phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!
 
Posts: 233
Karma: 50154
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: kindle
Struggling with RegEx

Not having ANY luck getting a RegEx to work right

Need 1. Break 'joined words with single UC letter inside:

lowerCase --> lower+Case ( the + is really a space char)
LowerCase --> Lower+Case ( the + is really a space char)

Need 2. Superscript ordinal suffixes

89th --> 89<sup>th</sup>
1st --> 1<sup>st</sup>

Thanks

Paul
phossler is offline   Reply With Quote
Old 01-03-2013, 12:51 AM   #2
Danger
Evangelist
Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.
 
Danger's Avatar
 
Posts: 468
Karma: 1665031
Join Date: Nov 2010
Location: Vancouver Island, Nanaimo
Device: K2 (retired), Kobo Touch (passed to the wife), KGlo
You could try the following...

Need 1:
Find: ([a-z])([A-Z])
Replace: \1+\2
Where + is really a space

Need 2:
Find: ([0-9])([a-z])([a-z])+
Replace: \1<sup>\2\3</sup>+
Where + is really a space
Danger is offline   Reply With Quote
Old 01-03-2013, 12:54 PM   #3
WS64
WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.
 
WS64's Avatar
 
Posts: 380
Karma: 504884
Join Date: Aug 2010
Location: Germany
Device: Bookeen Frontlight / Kobo Mini / Kindle 3 / Nook Color
Quote:
Originally Posted by Danger View Post
Need 2:
Find: ([0-9])([a-z])([a-z])+
Replace: \1<sup>\2\3</sup>+
Where + is really a space
That might be a bit dangerous since there could be other cases which should not be changed (like 50mph).

I use
find: (\s[0-9]+)(st|nd|rd|th)\s
replace: \1<sup>\2</sup>\s

Did I miss any (st|nd|rd|th) in my find statement? (not my native language)
WS64 is offline   Reply With Quote
Old 01-03-2013, 01:13 PM   #4
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 5,804
Karma: 4027751
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon
According to Wikipedia, the use of superscripts for ordinals in English should be avoided nowadays.
Jellby is offline   Reply With Quote
Old 01-03-2013, 01:57 PM   #5
phossler
Addict
phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!
 
Posts: 233
Karma: 50154
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: kindle
@Jellby --

Quote:
According to Wikipedia, the use of superscripts for ordinals in English should be avoided nowadays.
Thanks for the link

Quote:
The 16th edition of The Chicago Manual of Style states: "The letters in ordinal numbers should not appear as superscripts (e.g., 122nd not 122nd)", as do the Bluebook[1] and style guides by the Council of Science Editors,[2] Microsoft,[3] and Yahoo!.[4] Two problems are that superscripts are used "most often in citations" and are "tiny and hard to read".[1] Some word processors format ordinal indicators as superscripts by default (e.g. Microsoft Word[5]). Style guide author Jack Lynch (Rutgers) recommends turning off automatic superscripting of ordinals in MS Word, because "no professionally printed books use superscripts."[6]
Who can argue with that?

I'll also turn it off in my MS Word also


I will keep the RegEx and probably use it as a starting point for other things.

However, the most frustrating editing task right now is 'Need #1' to insert a space for text like "JohnSmith" (s/b "John Smith") and "missingLink" (s/b "missing Link"). I have no idea how so many words got joined

@Danger --

I'll try the suggestion tonight

Paul
phossler is offline   Reply With Quote
Old 01-03-2013, 03:25 PM   #6
Danger
Evangelist
Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.
 
Danger's Avatar
 
Posts: 468
Karma: 1665031
Join Date: Nov 2010
Location: Vancouver Island, Nanaimo
Device: K2 (retired), Kobo Touch (passed to the wife), KGlo
Quote:
Originally Posted by WS64 View Post
That might be a bit dangerous since there could be other cases which should not be changed (like 50mph).
While that might be dangerous. That search will only find any 2 lowercase letters that follow a number and have a space trailing them. So 50mph would not be picked up as it doesn't fit the criteria. Not saying it's fool proof though
Danger is offline   Reply With Quote
Old 01-03-2013, 10:29 PM   #7
phossler
Addict
phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!
 
Posts: 233
Karma: 50154
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: kindle
@Danger -- RegEx works very well

I was overthinking it

Simpler is better

Paul
phossler is offline   Reply With Quote
Old 01-04-2013, 01:42 PM   #8
Serpentine
Evangelist
Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
When in doubt : RegexBuddy

Really cant recommend it enough, tho it might be closed and windows-centric, it's got no equal. (ok there's a pretty good tk tool similar, but it's very tricky for most to use).
Serpentine is offline   Reply With Quote
Old 01-05-2013, 04:50 AM   #9
WS64
WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.
 
WS64's Avatar
 
Posts: 380
Karma: 504884
Join Date: Aug 2010
Location: Germany
Device: Bookeen Frontlight / Kobo Mini / Kindle 3 / Nook Color
[removed, I was reading the "+" wrong]

Last edited by WS64; 01-05-2013 at 04:54 AM.
WS64 is offline   Reply With Quote
Old 01-06-2013, 03:52 AM   #10
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 2,020
Karma: 10499963
Join Date: Apr 2010
Location: Phoenix, AZ
Device: Kindle2, iPad, KindleFire and NookColor
Quote:
Originally Posted by Serpentine View Post
When in doubt : RegexBuddy

Really cant recommend it enough, tho it might be closed and windows-centric, it's got no equal. (ok there's a pretty good tk tool similar, but it's very tricky for most to use).
+1 !

Hitch
Hitch is offline   Reply With Quote
Old 01-13-2013, 02:00 AM   #11
ElMiko
Addict
ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.
 
ElMiko's Avatar
 
Posts: 295
Karma: 56788
Join Date: Jun 2011
Device: Kindle
you may want to be careful with the lowercase-upper separator, as it will match (and modify) body text such as "McDonalds" and html code such as "preserveAspectRatio" and "viewBox".

I use something like:

Code:
(?<!Mac|Mc)(?<=\p{Ll})\p{Lu}(?!spect|atio|ox[=])
to exclude false positives, but even then I correct each instance individually (ie, not in bulk), just to be sure.

you could add parentheses around "\p{Lu}" and set the replace value as "[blank space]\1", but again, i would still recommend cycling through each instance individually.

Last edited by ElMiko; 01-13-2013 at 02:10 AM.
ElMiko is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
really struggling and need help! kirubiru Calibre 1 11-22-2011 09:28 PM
Struggling with one website sorcer Recipes 7 02-14-2011 09:35 AM
Unutterably Silly To all struggling with their Ph.D. LCF Lounge 2 02-11-2011 08:02 PM
Struggling with CLI Paulinafrica Calibre 4 01-08-2011 02:04 PM
struggling with calibre aprilquilts Amazon Kindle 9 12-19-2010 03:05 AM


All times are GMT -4. The time now is 01:13 AM.


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