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 03-25-2013, 03:03 PM   #1
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: 299
Karma: 56788
Join Date: Jun 2011
Device: Kindle
Can you match a NON-character...?

I'm trying to correct, in bulk, omissions of apostrophes, such as: Im, cant, wont, couldnt.

Is there a way to match the non-space between "t" and the penultimate letter so i can simple insert an apostrophe as a replace value?

basically, i'm looking for the functional equivalent of:

Code:
(?<=\bI)[non-space, non-character](?=m\b)
ElMiko is offline   Reply With Quote
Old 03-25-2013, 03:16 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,222
Karma: 5940081
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
not a REGEX solution

Have you tried the Spellcheck feature.

when you select a word in the list, then correct it for all occurrences
theducks is offline   Reply With Quote
 
Advertisement
Old 03-25-2013, 05:11 PM   #3
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: 299
Karma: 56788
Join Date: Jun 2011
Device: Kindle
DAAAAANG....

I figured as much, but I hoped one of the gurus would have a silver bullet where all my plain-vanilla lead bullets had failed.

Spellcheck doesn't catch several of the most common instances since they are, technically, words: Id, wont, cant. Well, if apostrophe strikes—sorry, i mean, epiphany—let me know...
ElMiko is offline   Reply With Quote
Old 03-25-2013, 05:28 PM   #4
meme
Sigil developer
meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.
 
Posts: 1,275
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
I'm sure there is a regex for what you want...theducks was just pointing out a non-regex approach.

The Spellcheck window can also list every word in your book, not just the misspelled ones. But even though you could filter on "t" there would probably still be a lot of words to look through. Even a regex would give you a lot of words to check as well if you're just looking for words ending in t.
meme is offline   Reply With Quote
Old 03-25-2013, 05:45 PM   #5
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,222
Karma: 5940081
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by ElMiko View Post
DAAAAANG....

I figured as much, but I hoped one of the gurus would have a silver bullet where all my plain-vanilla lead bullets had failed.

Spellcheck doesn't catch several of the most common instances since they are, technically, words: Id, wont, cant. Well, if apostrophe strikes—sorry, i mean, epiphany—let me know...
wan't the horrors of blind S&R

The spell check approach means you just check a few known words that might need the apostrophe

(you sill need to fix those other spelling errors )
theducks is offline   Reply With Quote
Old 03-25-2013, 06:37 PM   #6
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 9,515
Karma: 43764640
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I'm not certain I'm entirely following. In your pseudo-regex:
Code:
(?<=\bI)[non-space, non-character](?=m\b)
You seem to want to match the position in between Im (with word boundaries on either side) so you can replace that captured "position" with an apostrophe. But if you're basically going to run a search for "Im"... then why not just replace all instances of \bIm\b with "I'm". Or \b((?i)c)(?-i)ant\b with "\1an't" ? Shouldn't take too long to go through most of the common contractions.
DiapDealer is offline   Reply With Quote
Old 03-25-2013, 07:19 PM   #7
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: 299
Karma: 56788
Join Date: Jun 2011
Device: Kindle
Quote:
Originally Posted by DiapDealer View Post
I'm not certain I'm entirely following. In your pseudo-regex:
Code:
(?<=\bI)[non-space, non-character](?=m\b)
You seem to want to match the position in between Im (with word boundaries on either side) so you can replace that captured "position" with an apostrophe. But if you're basically going to run a search for "Im"... then why not just replace all instances of \bIm\b with "I'm". Or \b((?i)c)(?-i)ant\b with "\1an't" ? Shouldn't take too long to go through most of the common contractions.
... because there are actually lots of contractions. And typing each search out and a unique replace value would take a longer than doing what i'm trying to do. Obviously, it can be done the way you are suggesting—it's the way I've done it in the past... it hardly even counts as "RegEx".
ElMiko is offline   Reply With Quote
Old 03-25-2013, 08:27 PM   #8
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 9,515
Karma: 43764640
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by ElMiko View Post
... because there are actually lots of contractions. And typing each search out and a unique replace value would take a longer than doing what i'm trying to do. Obviously, it can be done the way you are suggesting—it's the way I've done it in the past... it hardly even counts as "RegEx".
My bad. I assumed from your example ("Im") that you were typing a similar search for each contraction.

Last edited by DiapDealer; 03-25-2013 at 08:37 PM.
DiapDealer is offline   Reply With Quote
Old 03-25-2013, 09:10 PM   #9
Tex2002ans
Fanatic
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 536
Karma: 562971
Join Date: Jul 2012
Device: Nook
Quote:
Originally Posted by ElMiko View Post
Obviously, it can be done the way you are suggesting—it's the way I've done it in the past... it hardly even counts as "RegEx".
There has to be a list of contractions somewhere.

You do the work once, create lots of Sigil Saved Searches replacing all of the unapostrophed with the apostrophe versions, and then spread your Saved Search file to everyone else, so we won't have to do it.
Tex2002ans is offline   Reply With Quote
Old 03-26-2013, 05:26 AM   #10
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: 6,309
Karma: 4898871
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Hmm... Would using the {0} multiplier work? Something like:

Code:
(?<=\bI)'{0}(?=m\b)
Maybe you could just use * instead of {0}. It would match one or more instances of the apostrophe, but it doesn't matter if it replaces an apostrophe by itself... and you surely don't want more than one apostrophe anyway
Jellby is online now   Reply With Quote
Old 03-26-2013, 11:18 PM   #11
Turtle91
Guru
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 669
Karma: 3807234
Join Date: Dec 2012
Location: Shannon, Ireland today
Device: iPhone 5/iPad 1&2/Surface Pro/Kindle PW
The list of normal contractions is relatively small (sorry the forum doesn't like tables but you can find it here):

aren't are not
can't cannot
couldn't could not
didn't did not
doesn't does not
don't do not
hadn't had not
hasn't has not
haven't have not
he'd he had; he would
he'll he will; he shall
he's he is; he has
I'd I had; I would
I'll I will; I shall
I'm I am
I've I have
isn't is not
let's let us
mightn't might not
mustn't must not
shan't shall not
she'd she had; she would
she'll she will; she shall
she's she is; she has
shouldn't should not
that's that is; that has
there's there is; there has
they'd they had; they would
they'll they will; they shall
they're they are
they've they have
we'd we had; we would
we're we are
we've we have
weren't were not
what'll what will; what shall
what're what are
what's what is; what has
what've what have
where's where is; where has
who'd who had; who would
who'll who will; who shall
who're who are
who's who is; who has
who've who have
won't will not
wouldn't would not
you'd you had; you would
you'll you will; you shall
you're you are
you've you have

There are multiple duplications that allow a handful of regex's to cover the list. I actually had a saved search group that did this - it was only a half-dozen or so steps. Unfortunately, I lost the group when my hard drive was replaced and haven't recreated it yet.
Turtle91 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
Does Kobo Price Match? Big McLargeHuge Kobo Reader 5 11-15-2012 12:28 AM
Can't match Unicode character atordo Recipes 2 06-15-2012 04:20 PM
how to have regex dot match any character including newline? gnychis Calibre 5 11-30-2010 07:35 PM
SonyStyle Price Match Zen-Diego Sony Reader 3 05-06-2009 04:07 PM


All times are GMT -4. The time now is 04:41 AM.


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