![]() |
#1 |
Junior Member
![]() 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 I tried variations of: Code:
\1 \2 |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,352
Karma: 203720150
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 |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 4
Karma: 10
Join Date: Mar 2011
Device: Nook Simple Touch
|
Oh thank you! Thanks for the quick response too. 1159 replacements made.
|
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,352
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#5 |
Junior Member
![]() 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.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 121
Karma: 5070
Join Date: Dec 2010
Device: none
|
|
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |