MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   match an empty line with a regex? (https://www.mobileread.com/forums/showthread.php?t=320391)

lumpynose 05-27-2019 08:42 PM

match an empty line with a regex?
 
How can I match an empty line with a regex? I tried both ^$ and ^\s*$ but it says No matches found for both of those. I have a bunch of plain text and I'd like to put a /p and then a p between the paragraphs where there are currently blank lines.

theducks 05-27-2019 09:11 PM

I always look (capture with the mouse) for the closing tag of the previous Paragraph, and newlines then Capture (.+?)to the Newline stuff between that and the <p class+...

lumpynose 05-27-2019 09:30 PM

Quote:

Originally Posted by theducks (Post 3849944)
I always look (capture with the mouse) for the closing tag of the previous Paragraph, and newlines then Capture (.+?)to the Newline stuff between that and the <p class+...

Heh, clever. You don't even need a regex. :smack:

Capricorn 05-28-2019 04:24 AM

TheDucks:
I have often had this question myself. Unfortunately I do not understand your explanation:
When you write "Capture with the Mouse", do you mean, simply select the area, i.e. the empty line, in question?
And "Capture (.+?)" throws me completely. I have no idea what that might mean or what I need to do.

In Stack Overflow I found a definition for Capture.Mouse but I still do not understand it.
Further explanation would be much appreciated.
Thanks.

lumpynose 05-28-2019 11:33 AM

Quote:

Originally Posted by Capricorn (Post 3850023)
TheDucks:
I have often had this question myself. Unfortunately I do not understand your explanation:
When you write "Capture with the Mouse", do you mean, simply select the area, i.e. the empty line, in question?
And "Capture (.+?)" throws me completely. I have no idea what that might mean or what I need to do.

In Stack Overflow I found a definition for Capture.Mouse but I still do not understand it.
Further explanation would be much appreciated.
Thanks.

Rather than use the mouse I used the keyboard since it's more precise: move the cursor to the end of the line for the paragraph above (e.g., just after the period), then while holding down the shift key use the right arrow key and move the cursor to the beginning of the line for the paragraph below (make sure you don't select its first character), then hit CTL+C to copy it to the clipboard, then hit CTL-F to go into Sigil's Find box where it has inserted the two "end of line" characters, then (once only) hit the tab key to go to the Replace box and in it put the /p and p tags with the angle brackets. The click the Find button followed by clicking the Replace/Find (or Replace All). After you do that all of the lines will have the /p and p tags between them but will have been joined into one big line; use Sigil's Tools > Reformat HTML > Mend and Prettify all HTML Files to fix that.

Capricorn 05-29-2019 04:03 AM

Thanks. Your explanation clarified it completely. Now I know what to do and how.


All times are GMT -4. The time now is 10:29 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.