View Single Post
Old 05-25-2012, 08:09 AM   #1
ghostyjack
Guru
ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.
 
ghostyjack's Avatar
 
Posts: 718
Karma: 1085610
Join Date: Mar 2009
Location: Bristol, England
Device: PRS-T1, 1825PT, Galaxy Tab, One X, TF700T, Aura HD, Nexus 7
Can't seem to get regex to work in Sigil

I'm obviously not getting to grips with regex, even after reading what I can find here.

I've imported a HTML file into Sigil that was generated by Word so I've got an absolute mass of "MsoNormal" classes on my <p> tags. The original file was in a very bad state and would have taken far too much time to tidy it up in Word, so I though I'd do it in Sigil with regex. It also turned out that virtually every paragraph had a different style, so I've also got lots of Sigil-generated styles as well for each paragraph, approximately 5,000 of them.

There is no way I'm going to go through this line-by-line and remove them one at a time, so the only way I can see to remove them is with regex.

So, to my problem.

The <p> tag looks like:

Code:
<p class="MsoNormal sgc-669">
With the number ranging anywhere from 1 to 5000.

This is what I put into the Find field:

Code:
<p class="MsoNormal sgc-\d\+">
With Replace being:

Code:
<p>
I've set the mode as being Regex and the Look being Current File (I've manually split the file into separate chapter files) as I'm doing it chapter-by-chapter so as to reduce the number of mistakes.

When I do this though, Sigil tells me it could find no matches. So, either I've made a mistake in my regex, or Sigil is not working properly for me.

So can anyone tell me if my regex is wrong and what I need to do to correct it please.
ghostyjack is offline   Reply With Quote