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-05-2012, 08:26 AM   #1
cptsmidge
Junior Member
cptsmidge began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2011
Device: Nook Simple Touch
Quick Regex Question

Hey, sorry to bother everyone with another Regex question.

My book has weird question marks in place of hyphens (book?worm, land?locked), and I was trying to replace it, but I can't get the replace string to work.

Right now I'm using this as the search string, which seems to only select the question marks with characters on either side (not proper question marks):

Code:
\w\?\w
But no matter what I try in the "Replace" area, whatever I typed gets inserted into the code.

I tried variations of:

Code:
\1 \2
But no luck.
cptsmidge is offline   Reply With Quote
Old 03-05-2012, 08:40 AM   #2
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,117
Karma: 40942904
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
You have no capture groups in your search expression. So it doesn't know what to replace and what to keep.

Code:
(\w)\?(\w)
Code:
\1-\2
should then replace the "?" with the "-" and keep the two original word-characters preceding and following.
DiapDealer is offline   Reply With Quote
 
Enthusiast
Old 03-05-2012, 10:26 AM   #3
cptsmidge
Junior Member
cptsmidge began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2011
Device: Nook Simple Touch
Oh thank you! Thanks for the quick response too. 1159 replacements made.
cptsmidge is offline   Reply With Quote
Old 03-05-2012, 12:14 PM   #4
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,117
Karma: 40942904
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Oh thank you! Thanks for the quick response too. 1159 replacements made.
You're quite welcome. But I hope you stepped through several instances to make sure it was doing what you wanted before you hit "Replace All."
DiapDealer is offline   Reply With Quote
Old 03-05-2012, 12:21 PM   #5
cptsmidge
Junior Member
cptsmidge began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2011
Device: Nook Simple Touch
Absolutely. I did probably 3 complete html documents before I committed. It isn't perfect, but that's the fault of the inconsistency of the file, not the code.
cptsmidge is offline   Reply With Quote
Old 03-05-2012, 01:12 PM   #6
huebi
Zealot
huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!
 
Posts: 121
Karma: 5070
Join Date: Dec 2010
Device: none
Quote:
Originally Posted by DiapDealer View Post
But I hope you stepped through several instances to make sure it was doing what you wanted before you hit "Replace All."
No risk, no fun.
huebi is offline   Reply With Quote
Old 03-06-2012, 04:20 AM   #7
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 2,967
Karma: 3427611
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
Quote:
Originally Posted by huebi View Post
No risk, no fun.
Toxaris 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
Yet another regex question Jabby Sigil 8 01-30-2012 08:41 PM
Regex Question involving multiple . (periods) hanbalfrek Conversion 11 08-29-2011 05:06 PM
Regex question and maybe some help crutledge Sigil 9 03-10-2011 04:37 PM
Regex Question Archon Conversion 11 02-05-2011 10:13 AM
Import files, regex question al35 Calibre 0 03-22-2010 12:33 PM


All times are GMT -4. The time now is 05:59 PM.


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