Thread: Regex examples
View Single Post
Old 07-02-2013, 03:21 AM   #263
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,607
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Hi

I am not sure if this is the right thread (Regex examples!?) for this but I have been quoted for an old post by BangBangO. This post was sent a long time ago, before I knew there could be better solutions -mostly from Jellby.

I never tried to emulate nnbsp (narrow non-breaking space or espace fine in French) in any book of mine. I just quoted this possibility, which I really find heavy and unelegant.

The 90% good solution is to code the nnbsp. ADE 2.0 will take care of it.
The 100% best solution is to code the nnbsp and to use a font which already supports it.

However, even the 100% best will not avoid you falling apart with inventive Kobo hyphenation display (some attribute this poor showing to Adobe mobile renderer, of this I can't say).

https://www.mobileread.com/forums/sho...&postcount=153

And to get back on the right track, this is the regex I use now to convert nbsp to nnbsp, following French typographic rules.

S: ([«]) | ([;!?»])
R: \1&#8239-;\2

Note: To get it working you need to suppress the - after 8239.

Last edited by roger64; 07-02-2013 at 04:00 AM.
roger64 is offline   Reply With Quote