01-10-2023, 03:09 AM | #1 |
Enthusiast
Posts: 40
Karma: 10
Join Date: Oct 2012
Location: Lyon [France]
Device: JuliusvonJD
|
Regex / Find and Replace Non Breaking Space
I want to swap some space characters and non-breaking space.
In the test the search works with \x20 (32) but not with \xa0 (160 / nbsp). Which code to use for the nbsp? I have tried several without success. Thanks |
01-10-2023, 03:29 AM | #2 |
Wizard
Posts: 1,089
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
You could simply copy the nbsp from the text and paste it into the Find bar.
You don't need any fancy code. |
01-10-2023, 04:59 AM | #3 |
Enthusiast
Posts: 40
Karma: 10
Join Date: Oct 2012
Location: Lyon [France]
Device: JuliusvonJD
|
|
01-10-2023, 08:45 AM | #4 |
creator of calibre
Posts: 43,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
It works fine make sure the mode in the search panel is normal or regex
|
01-10-2023, 12:14 PM | #5 |
Enthusiast
Posts: 40
Karma: 10
Join Date: Oct 2012
Location: Lyon [France]
Device: JuliusvonJD
|
Sorry, I wasn't clear.
I meant the conversion tool not the editing tool. With "Find and Replace" function. I want to use it to turn a lot of (but not all) nbps into normal spaces. with a function like this : Rch = ([!\«\–\—])\xA0([!\;\:\?\!\»]) Rpl = \1\20\2 So I tried to start by finding one NBPS ! I put a picture. Thanks for calibre. It's great. |
01-13-2023, 09:06 AM | #6 |
Enthusiast
Posts: 40
Karma: 10
Join Date: Oct 2012
Location: Lyon [France]
Device: JuliusvonJD
|
It works like this in "Edit Book" or "Search & replace" of "Convert book"
([^–«—])\xa0([^!?;:»]) => \1\x20\2 and to change normal into nbps - before ! ? ; :» \x20([!?;:»]) => \xa0\1 - After – — « ([–«—])\x20 => \1\xa0 The code a0 of the nbps is not found in the test (all spaces are shown). Last edited by aurigod; 01-15-2023 at 03:13 AM. |
01-14-2023, 01:29 AM | #7 |
creator of calibre
Posts: 43,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
New to regex find and replace! | ksimpson1986 | Sigil | 2 | 11-06-2016 11:29 AM |
How to make regex to replace 2 spaces between words, with one space? | crankypants | Sigil | 4 | 10-29-2015 11:51 AM |
regex cannot find to replace | eschwartz | Editor | 11 | 02-03-2014 11:00 PM |
Regex find and replace | SanatyrZeo | Sigil | 5 | 10-29-2012 07:03 AM |
RegEx find and replace | iblesq | Sigil | 1 | 01-10-2011 09:26 PM |