Quantcast
Channel: MobileRead Forums - Calibre
Viewing all articles
Browse latest Browse all 31494

Replace multiple matching instances within paragraph?

$
0
0
I'm trying to use a regex to replace all instances of a given match (in this case line breaks) within paragraph markings. I cannot simply replace all <br/> instances in my document because some are important to have.

The document layout looks something like this:
Code:

<p>some text here<br/> more text here<br/> a lot more words<br/> final part</p>
I would like it to become:
Code:

<p>some text here more text here a lot more words final part</p>
While I am pretty good at advanced regular expressions, I am thinking that what I'm asking for here would require back references to replace the <br/>'s with nothing.

Could somebody here show me how to do this, or has there been a thread about this already?

So far I have started with:
Code:

<p>(([a-zA-Z',;. ])+<br/>)+
and that seems to work in this regex tester program I am using, but what would I enter into the replace field in Calibre for this? Do I need back-references?

Thanks,
Chris

Viewing all articles
Browse latest Browse all 31494

Trending Articles