10-03-2014, 11:00 AM | #421 |
Well trained by Cats
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
|
|
10-03-2014, 11:20 AM | #422 |
Grand Sorcerer
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? |
Advert | |
|
10-08-2014, 12:39 AM | #423 |
Member
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:
\>.*".*[^(")]
Is this feasible? Last edited by dwlamb; 10-08-2014 at 12:41 AM. Reason: fixed errors |
10-08-2014, 01:36 AM | #424 |
Banned
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. |
10-08-2014, 10:12 AM | #425 |
Member
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. |
Advert | |
|
10-08-2014, 02:29 PM | #426 |
Banned
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. |
10-08-2014, 05:53 PM | #427 |
Ex-Helpdesk Junkie
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> This one finds text before the quotes too: Code:
<p( [^<>]+)?>((?!</p>).)*["“]((?!</p>).)*[^"”]</p>
Last edited by eschwartz; 10-08-2014 at 05:58 PM. |
10-10-2014, 12:53 AM | #428 | |
Member
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> or<p class="some_class">Proin non ex ex? Aliquam. Nam tristique scelerisque orci, et."</p> <p class="some_class">"Sed eget nulla vel augue. Proin id metus sed mi.</p> Thanks for the help.<p class="some_class">Sed sed eleifend ex! Phasellus justo lectus, tempor id mollis."</p> Quote:
|
|
10-11-2014, 03:59 PM | #429 |
Zealot
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.
|
10-11-2014, 11:53 PM | #430 | |
Ex-Helpdesk Junkie
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:
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. |
|
11-18-2014, 04:09 AM | #431 |
Member
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 |
11-18-2014, 08:06 AM | #432 |
Enthusiast
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’)(?!’) |
11-18-2014, 11:36 AM | #433 |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
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. |
11-18-2014, 12:07 PM | #434 | |
Member
Posts: 12
Karma: 79192
Join Date: Nov 2014
Device: Kindle
|
Quote:
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 |
|
11-18-2014, 01:54 PM | #435 |
Zealot
Posts: 119
Karma: 64428
Join Date: Aug 2011
Device: none
|
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.
|
|
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 |