View Single Post
Old 02-22-2012, 06:03 PM   #1
murphycc
Member
murphycc ought to be getting tired of karma fortunes by now.murphycc ought to be getting tired of karma fortunes by now.murphycc ought to be getting tired of karma fortunes by now.murphycc ought to be getting tired of karma fortunes by now.murphycc ought to be getting tired of karma fortunes by now.murphycc ought to be getting tired of karma fortunes by now.murphycc ought to be getting tired of karma fortunes by now.murphycc ought to be getting tired of karma fortunes by now.murphycc ought to be getting tired of karma fortunes by now.murphycc ought to be getting tired of karma fortunes by now.murphycc ought to be getting tired of karma fortunes by now.
 
Posts: 14
Karma: 475352
Join Date: Feb 2012
Device: Kindle Paperwhite 2
Replace multiple matching instances within paragraph?

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
murphycc is offline   Reply With Quote