Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 05-27-2019, 07:42 PM   #1
lumpynose
Wizard
lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.
 
Posts: 1,086
Karma: 6719822
Join Date: Jul 2012
Device: Palm Pilot M105
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.
lumpynose is offline   Reply With Quote
Old 05-27-2019, 08:11 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,891
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
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+...
theducks is offline   Reply With Quote
Old 05-27-2019, 08:30 PM   #3
lumpynose
Wizard
lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.
 
Posts: 1,086
Karma: 6719822
Join Date: Jul 2012
Device: Palm Pilot M105
Quote:
Originally Posted by theducks View Post
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.
lumpynose is offline   Reply With Quote
Old 05-28-2019, 03:24 AM   #4
Capricorn
Belgian Pommes Frites
Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.
 
Posts: 122
Karma: 35038
Join Date: Jan 2012
Device: Pocketbook Touch HD
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.
Capricorn is offline   Reply With Quote
Old 05-28-2019, 10:33 AM   #5
lumpynose
Wizard
lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.
 
Posts: 1,086
Karma: 6719822
Join Date: Jul 2012
Device: Palm Pilot M105
Quote:
Originally Posted by Capricorn View Post
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.

Last edited by lumpynose; 05-29-2019 at 04:34 PM.
lumpynose is offline   Reply With Quote
Old 05-29-2019, 03:03 AM   #6
Capricorn
Belgian Pommes Frites
Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.
 
Posts: 122
Karma: 35038
Join Date: Jan 2012
Device: Pocketbook Touch HD
Thanks. Your explanation clarified it completely. Now I know what to do and how.
Capricorn is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
REGEX match everything before # JLius ePub 2 01-08-2017 04:25 PM
[Regex Search] Minimal match not possible? nqk Editor 7 12-24-2014 03:19 AM
Replace field with match or empty string? charlweed Library Management 2 03-29-2012 12:44 AM
how to have regex dot match any character including newline? gnychis Calibre 5 11-30-2010 06:35 PM
Need help with a conversion regex - can't match newline ereader123 Calibre 2 03-29-2010 10:58 AM


All times are GMT -4. The time now is 12:01 PM.


MobileRead.com is a privately owned, operated and funded community.