Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 10-03-2014, 11:00 AM   #421
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: 29,806
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by DiapDealer View Post
Be be or not be twice?
A William S find
theducks is offline   Reply With Quote
Old 10-03-2014, 11:20 AM   #422
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,551
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
In my desire to be concise as possible, I would probably represent Shakespeare's famous line in regex as:
Code:
b?
DiapDealer is online now   Reply With Quote
Advert
Old 10-08-2014, 12:39 AM   #423
dwlamb
Member
dwlamb began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Apr 2013
Device: Android Smartphone
Looking for dialogue with paragraph breaks

Hello,

I am trying to come up with a method to search for blocks of HTML in which dialogue was started but a new paragraph was started before the closing quotation mark.

I have a string of
Code:
\>.*".*[^(")]
Basically I want to find
  • text starting after the opening <p> tag and before an opening quotation mark
  • the opening quotation mark
  • the block of text up to the end of the paragraph, provided there is no closing quotation mark before the \n

Is this feasible?

Last edited by dwlamb; 10-08-2014 at 12:41 AM. Reason: fixed errors
dwlamb is offline   Reply With Quote
Old 10-08-2014, 01:36 AM   #424
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
deleted. strange, my posting was declared off topic. Dumb postings above not. Now you can block me

Last edited by rubeus; 10-08-2014 at 02:34 PM.
rubeus is offline   Reply With Quote
Old 10-08-2014, 10:12 AM   #425
dwlamb
Member
dwlamb began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Apr 2013
Device: Android Smartphone
rubeus:
The only inference of replace all has been in your reply, rubeus. My intent is clear: find

The criteria I want would only look for a dialogue that is started but not closed by the time a </p>\n happens. The search matched, I would then visually inspect why it matches which would deal with possible situations you specify.
dwlamb is offline   Reply With Quote
Advert
Old 10-08-2014, 02:29 PM   #426
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
If you are only looking for one aspect, my posting was off topic: But to be honest: it wasnt really clear that you are interested only in findings.

Well, you just skiupped al other problems i mentioned, so i guess you're no longer interested in my opinion. I'm fine with that.

Last famous words: using the off topcsmiley was rude,in my opinion. Bye.
rubeus is offline   Reply With Quote
Old 10-08-2014, 05:53 PM   #427
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Find:
Code:
<p( [^<>]+)?>["“]((?!</p>).)*[^"”]</p>
Assumes the paragraph starts with a quote mark, accounts for smart or dumb quotes, matches optional attributes in the para tag, and matches tags in the paragraph assuming they aren't the para tag (see HERE for how).

This one finds text before the quotes too:
Code:
<p( [^<>]+)?>((?!</p>).)*["“]((?!</p>).)*[^"”]</p>

Last edited by eschwartz; 10-08-2014 at 05:58 PM.
eschwartz is offline   Reply With Quote
Old 10-10-2014, 12:53 AM   #428
dwlamb
Member
dwlamb began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Apr 2013
Device: Android Smartphone
Hi,

Thank you for responding. I tried your syntax and it is catching any paragraph that has quoted text properly formed or not. Is it possible you can further break down what your search strings do so that I can piece-meal learn and experiment? I read the item from stackoverflow but it was fuzzy to me.

To give more of an example of the text I am searching for, I have these examples:
<p class="some_class">"Phasellus in ante ac lectus," said Ceasar. Vestibulum neque nisi, dapibus quis, "Sed et magna eget orci.</p>

<p class="some_class">Proin non ex ex? Aliquam. Nam tristique scelerisque orci, et."</p>
or
<p class="some_class">"Sed eget nulla vel augue. Proin id metus sed mi.</p>

<p class="some_class">Sed sed eleifend ex! Phasellus justo lectus, tempor id mollis."</p>
Thanks for the help.

Quote:
Originally Posted by eschwartz View Post
Find:
Code:
<p( [^<>]+)?>["“]((?!</p>).)*[^"”]</p>
Assumes the paragraph starts with a quote mark, accounts for smart or dumb quotes, matches optional attributes in the para tag, and matches tags in the paragraph assuming they aren't the para tag (see HERE for how).

This one finds text before the quotes too:
Code:
<p( [^<>]+)?>((?!</p>).)*["“]((?!</p>).)*[^"”]</p>
dwlamb is offline   Reply With Quote
Old 10-11-2014, 03:59 PM   #429
signum
Zealot
signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.
 
Posts: 119
Karma: 64428
Join Date: Aug 2011
Device: none
In my opinion, I don't think it's possible to write a single regular expression to do what you want. REs are not a general programming language and are quite limited in some respects. I wrote a short program to step through an htm file and find the number of ldquos, rdquos and quots in each paragraph. If the number of ldquos didn't equal the number of rdquos or the number of quots was odd, it adds a class="unbal" to the paragraph. Regular expressions are usually incapable of counting, comparing two registers or taking the modulus of a number. I would be pleased to be shown wrong, using the RE syntax in Sigil.
signum is offline   Reply With Quote
Old 10-11-2014, 11:53 PM   #430
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by signum View Post
In my opinion, I don't think it's possible to write a single regular expression to do what you want. REs are not a general programming language and are quite limited in some respects. I wrote a short program to step through an htm file and find the number of ldquos, rdquos and quots in each paragraph. If the number of ldquos didn't equal the number of rdquos or the number of quots was odd, it adds a class="unbal" to the paragraph. Regular expressions are usually incapable of counting, comparing two registers or taking the modulus of a number. I would be pleased to be shown wrong, using the RE syntax in Sigil.
That is also a different case.

Note that my, WORKING, solution is not a true regular expression either. But regular expressions are not nearly as useful as regex+lookaround, so it was decided that regular expressions need not in fact be regular.
eschwartz is offline   Reply With Quote
Old 11-18-2014, 04:09 AM   #431
Buchstabensalat
Member
Buchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one hand
 
Posts: 12
Karma: 79192
Join Date: Nov 2014
Device: Kindle
Hi,

As a newbie to the secrets of regex I am searching a regex formula finding (and then correcting) words that contain one or more upper case letters in them, excluding the first letter from the search. Example:

1. neWbie or nEwBie -> newbie
2. NeWbie or NEwBie -> Newbie

Please help. Thank you.

Regards

Buchstabensalat
Buchstabensalat is offline   Reply With Quote
Old 11-18-2014, 08:06 AM   #432
darrenmcg
Enthusiast
darrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
Posts: 31
Karma: 12920
Join Date: Nov 2014
Device: Voyage 5.8.9.2
@ dwlamb

These are two I've been using to find something similar, maybe they can help...

“(?>[^\r\n“”]*)(?!\r?\n“)(?!”)
‘(?>[^\r\n‘’]*)(?!\r?\n’)(?!’)
darrenmcg is offline   Reply With Quote
Old 11-18-2014, 11:36 AM   #433
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Buchstabensalat View Post
1. neWbie or nEwBie -> newbie
Find:([[:alpha:]]+)
Replace:\L\1\E

Quote:
Originally Posted by Buchstabensalat View Post
2. NeWbie or NEwBie -> Newbie
Find:([[:upper:]])([[:alpha:]]+)
Replace:\1\L\2\E

Note that these expressions will also find some non-mixed case words and won't work with accented characters and umlauts.

You can find more examples here.
Doitsu is offline   Reply With Quote
Old 11-18-2014, 12:07 PM   #434
Buchstabensalat
Member
Buchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one handBuchstabensalat can read with one hand
 
Posts: 12
Karma: 79192
Join Date: Nov 2014
Device: Kindle
Quote:
Originally Posted by Doitsu View Post
Find:([[:alpha:]]+)
Replace:\L\1\E



Find:([[:upper:]])([[:alpha:]]+)
Replace:\1\L\2\E

Note that these expressions will also find some non-mixed case words and won't work with accented characters and umlauts.

You can find more examples here.
Hi,

Thank you.

Using Sigil`s search (regex mode) your first string finds every single word in the text, the second string matches every uppercase word in my text and not only those that meet my search criteria ( uppercase letter(s) within a word). Is there a possiblity to match only those words with upercase letters in the word ?

Thanks again

Regards,

Buchstabensalat
Buchstabensalat is offline   Reply With Quote
Old 11-18-2014, 01:54 PM   #435
signum
Zealot
signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.
 
Posts: 119
Karma: 64428
Join Date: Aug 2011
Device: none
Quote:
Originally Posted by eschwartz View Post
That is also a different case.

Note that my, WORKING, solution is not a true regular expression either. But regular expressions are not nearly as useful as regex+lookaround, so it was decided that regular expressions need not in fact be regular.
Yeah, it works, sorta. But it matches all paragraphs with quotation marks, whether or not they are "valid", i.e. matched or balanced. This was first reported by the OP in msg #428, above.
signum is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Examples of Subgroups emonti8384 Lounge 32 02-26-2011 06:00 PM
Accessories Pen examples Gunnerp245 enTourage Archive 15 02-21-2011 03:23 PM
Stylesheet examples? Skitzman69 Sigil 15 09-24-2010 08:24 PM
Examples kafkaesque1978 iRiver Story 1 07-26-2010 03:49 PM
Looking for examples of typos in eBooks Tonycole General Discussions 1 05-05-2010 04:23 AM


All times are GMT -4. The time now is 02:26 PM.


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