Thread: Regex examples
View Single Post
Old 09-21-2014, 12:12 PM   #417
JimmyG
Zealot
JimmyG solves Fermat’s last theorem while doing the crossword.JimmyG solves Fermat’s last theorem while doing the crossword.JimmyG solves Fermat’s last theorem while doing the crossword.JimmyG solves Fermat’s last theorem while doing the crossword.JimmyG solves Fermat’s last theorem while doing the crossword.JimmyG solves Fermat’s last theorem while doing the crossword.JimmyG solves Fermat’s last theorem while doing the crossword.JimmyG solves Fermat’s last theorem while doing the crossword.JimmyG solves Fermat’s last theorem while doing the crossword.JimmyG solves Fermat’s last theorem while doing the crossword.JimmyG solves Fermat’s last theorem while doing the crossword.
 
Posts: 119
Karma: 28454
Join Date: Apr 2011
Location: Yuma, AZ
Device: Kindle Touch, Voyage
Quote:
Originally Posted by DiapDealer View Post
You got your anchors flipped ^ is the beginning of a string(or line) and $ is the end.

But even ^([^<].+)$ isn't going to be very useful in a Sigil formatted file. "Lines" get very hairy in a file. A paragraph is typically on one "line" (meaning no line-break characters) from <p> to </p>. Same with just about any block-level element. And many lines are likely to be indented, so they don't start with "<" they start with a space. That's probably why they're getting included in your search.

It's including blank lines because blank lines DON'T start with a "<", they start with line-break character(s).

There really shouldn't be any (or very, very few anyway) "lines" that don't begin with a "<" (or an indent before a "<"). Some css styling in the header and the like maybe.

If it's these relatively rare instances you're looking for perhaps something like:
Code:
^\w.+$
might come close?
Yeah, I caught that $^. I was making my problem too complicated by trying to do it in Sigil. The lines without p tags are all contiguous, so I just copy them to EditPadPro (where ^([^<].*)$ does not include the blank line) and then copy them back to Sigil. Actually, doing it that way, ^(.+)$ should work, but the original worked so I just left it.

Last edited by JimmyG; 09-21-2014 at 12:14 PM.
JimmyG is offline   Reply With Quote