View Single Post
Old 02-10-2020, 01:17 AM   #28
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by roger64 View Post
Search and replace excluding the headers

I am trying to insert old nums in an ePub. For this I need to wrap a span around these characters like:

Code:
(\d+)
<span class="smcp" >\1</span>
However I need to exclude the headers, if not I have to correct all of them...
Could a function do it?
If this is just numbers in paragraphs, you could do:

Code:
(<p>.*?)(\d+)(.*?</p>)
With the replace:

Code:
\1<span class="smcp" >\2</span>\3
That does have a problem if a paragraph has more than one number in the paragraph. The following might be better, but, it still has issues:

Code:
(<p>.*?[^\>\d])(\d+)(.*?</p>)
davidfor is offline   Reply With Quote