View Single Post
Old 12-06-2012, 02:48 PM   #1
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 2,997
Karma: 1285294
Join Date: Sep 2010
Device: Kobo aura HD, Kobo Arc, Kindle Fire HDX 8.9 , Kindle for PC
Question regex (.*) not liking hidden characters

trying to fix a book where div has been used rather than p throughout

so book layout layout is thousands of lines/paragraphse like thesethese:

<div class="c3">
some body text beginning on a new line, followed by the closing div tag, also on a new line
</div>

I would expect this to work:
find
<div class="c3">(.*)</div>
replace all
<p class="c3">\1</p>

but I get no matches.

to get the regex to work, I carefully have to copy & paste in whatever hidden characters are separating the div tags from the body text i.e. whatever is causing the line breaks.

the (.*) regex then works as expected once it is within the linebreak characters

so is this
a) just a vary badly formatted source
b) some side effect of pretty print / tidy settings
c) a bug in regex engine or ( more likely!) in my understanding of how it should work ?

now I think ( from limited testing )that pretty print has no issues with
<div> all on one line example </div>
layouts so it is probably not option b) ?
cybmole is offline   Reply With Quote