Thread: Regex examples
View Single Post
Old 04-24-2020, 04:50 AM   #634
Tex2002ans
Wizard
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: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by Mister L View Post
Just did a book today with 2313 dashes in it (x_x) so the new and improved regex was greatly appreciated.


Quote:
Originally Posted by Mister L View Post
Oops, just noticed that my code got eaten... my replace is –# 160 ;\1# 160 ;– only without the spaces, obviously.
You can get around this restriction by using the [ noparse] [/noparse] tag, but you have to "break" the entity in the middle (I usually shove it right after the ampersand):

Code:
–&[ noparse]#160;[/noparse]\1&[ noparse]#160;[/noparse]–
which will get you this:

– \1 –

The forum "helpfully" decides to substitute characters, but in this case, we don't want them, so we tell it "not to parse".

Last edited by Tex2002ans; 04-24-2020 at 04:52 AM.
Tex2002ans is offline   Reply With Quote