![]() |
#406 |
Member
![]() Posts: 24
Karma: 10
Join Date: Mar 2011
Location: Colorado
Device: Cruz Tablet
|
|
![]() |
![]() |
![]() |
#407 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
![]() It woud be better to use a catchall like Find: Code:
((Mr|Mrs|Dr|other)\.)</p>\s*<p( [^>]*)?> Code:
\1 Last edited by eschwartz; 08-31-2014 at 01:01 AM. |
|
![]() |
![]() |
![]() |
#408 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,647
Karma: 204624552
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
Code:
((Mr|Mrs|Dr|other)\.)</p>\s*<p[^>]*?> Code:
\1 instead? ![]() |
|
![]() |
![]() |
![]() |
#409 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
![]() Nitpick: I used an optional capture group, which includes a space (because as a general idea, I like demanding spaces after the tag name and before the attribute, to avoid matching the wrong tags) -- but your regex does not need a ? because the star already covers that. ![]() Last edited by eschwartz; 08-31-2014 at 10:57 AM. |
|
![]() |
![]() |
![]() |
#410 | |
Member
![]() Posts: 24
Karma: 10
Join Date: Mar 2011
Location: Colorado
Device: Cruz Tablet
|
![]() Quote:
![]() |
|
![]() |
![]() |
![]() |
#411 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,647
Karma: 204624552
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
My bad. I didn't notice the space was inside the optional grouping. Part of the reason I don't like to use a lot of extraneous grouping in my regex.
![]() Quote:
Code:
<p\b[^>]*> Code:
<p\M[^>]*> |
|
![]() |
![]() |
![]() |
#412 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
![]() Po-tay-to po-tah-to. Doesn't confuse me, I got used to doing it this way (seems in my subjective opinion to make more sense), etc. Never really fell in love with word boundaries. |
|
![]() |
![]() |
![]() |
#413 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,647
Karma: 204624552
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Oh, absolutely. Lots of ways to skin the same cat. I don't love any of it, to tell the truth. I just find word boundaries to useful NOT to use. *shrug*
|
![]() |
![]() |
![]() |
#414 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 119
Karma: 28454
Join Date: Apr 2011
Location: Yuma, AZ
Device: Kindle Touch, Voyage
|
What am I doing wrong?
Okay this regex $(.+)^ finds whole lines with text in them.
But I don't want lines that start with <, so I tried this $([^<].+)^ but that includes any preceding blank line and the next line, whether it starts with < or not, and I don't know why. I want whole lines (not empty) that don't start with a tag. Last edited by JimmyG; 09-20-2014 at 06:13 PM. Reason: clarify |
![]() |
![]() |
![]() |
#415 | |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 171
Karma: 86271
Join Date: Feb 2012
Device: iPad, Kindle Touch, Sony PRS-T1
|
Quote:
if you're trying to find lines in an html document that don't begin with a < (which would be very rare), then you could use something like Code:
^\s*[^<\s]+ |
|
![]() |
![]() |
![]() |
#416 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,647
Karma: 204624552
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
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.+$ |
|
![]() |
![]() |
![]() |
#417 | |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 119
Karma: 28454
Join Date: Apr 2011
Location: Yuma, AZ
Device: Kindle Touch, Voyage
|
Quote:
Last edited by JimmyG; 09-21-2014 at 12:14 PM. |
|
![]() |
![]() |
![]() |
#418 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,736
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
|
off-topic: I saw this Regex T-Shirt yesterday in the subway and it took me at least 5 minutes to figure it out.
![]() ![]() |
![]() |
![]() |
![]() |
#419 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 92
Karma: 17950
Join Date: Mar 2013
Device: Xodo
|
I think it should be:
Code:
(bb|[^2]b) |
![]() |
![]() |
![]() |
#420 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,647
Karma: 204624552
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Be be or not be twice?
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |