Thread: Regex examples
View Single Post
Old 08-06-2012, 10:22 AM   #111
Danger
Evangelist
Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.Danger ought to be getting tired of karma fortunes by now.
 
Danger's Avatar
 
Posts: 490
Karma: 1665031
Join Date: Nov 2010
Location: Vancouver Island, Nanaimo
Device: K2 (retired), Kobo Touch (passed to the wife), KGlo, Galaxy TabPro
First thanks for everyones help here. While I haven't posted for help the answers to other peoples problems has helped me as well when I had similar questions. however I have a question that I don't see an answer to.

I am trying to remove a start and end div tag. These span an entire chapter.
Code:
<body>
  <div class="story" id="part-27">
...
  </div>
</body>
I've tried:
FIND
Code:
<div class="story" id="part-\d+">(.*?)</div>
&
Code:
<div class="story" id="part-\d+">(.*)</div>
and a few other variations but Sigil always returns a zero count. Just wondering what I am doing wrong. This isn't the first time I've run into this problem. Before I've just worked around it by working with much smaller bits but I'd like to know just what it is I am doing wrong because as far as I can tell that should work. Using Sigil 0.5.902

EDIT:
Ok it seems that the regex was fine, it just doesn't work in 0.5.902 but does work in 0.5.3 which I don't like using much for finding/replacing because over half the time I get left with a literal \1 instead of the actual text. Which of course I have to UNDO, FIND, REPLACE for each. Easy enough when it's a large block of text, not so easy when it's a word or sentence forcing me to do another FIND for any 1< instances. A REPLACE ALL is just a nightmare if you don't have a backup.

Last edited by Danger; 08-06-2012 at 10:40 AM.
Danger is offline   Reply With Quote