|  01-02-2015, 05:04 PM | #451 | 
| Junior Member            Posts: 2 Karma: 75742 Join Date: Jan 2015 Location: Lees, United Kingdom Device: none | 
			
			This will work: <span class="italics">\w+ [\w+ ,]{1,}</span> You may want to add all punctuation characters or any character a sentence may include. You can change this to: <span class="italics">\w+ [\w+ ,\.\?\-]{1,}</span> | 
|   |   | 
|  01-02-2015, 05:56 PM | #452 | 
| Grand Sorcerer            Posts: 28,880 Karma: 207000000 Join Date: Jan 2010 Device: Nexus 7, Kindle Fire HD | 
			
			Whose question are you answering?
		 | 
|   |   | 
|  01-12-2015, 10:34 AM | #453 | 
| Groupie            Posts: 173 Karma: 40000 Join Date: Oct 2013 Device: kindle | 
				
				Removing empty html elements
			 
			
			How about a regex that finds everything that has the structure of <AAAwhatever></AAA> i.e. all empty html elements. Or, even better, all elements that either are empty or that contain just a space. EDIT Looks like this one is working, though I'm not entirely sure why. Code: <[^/>]+>[ \n\r\t]*</[^>]+> Last edited by 1v4n0; 01-12-2015 at 10:51 AM. | 
|   |   | 
|  01-12-2015, 10:55 AM | #454 | 
| 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) | Code: <(\w+)( [^<>]+)?>(\s| )*</\1> Last edited by eschwartz; 01-12-2015 at 11:00 AM. | 
|   |   | 
|  01-12-2015, 11:06 AM | #455 | ||
| Groupie            Posts: 171 Karma: 86271 Join Date: Feb 2012 Device: iPad, Kindle Touch, Sony PRS-T1 | Quote: 
 <p><i><b><br/></b></i></p> Code: (?s)<p[^>]*?>\s*?(?:<\w[^>/]*?>)*?\s*?(?: |*|<br(?:\s|\s/|/)?>)*?\s*?(?:</\w[^>/]*?>)*?\s*?</p> Quote: 
 Code: <[^/>]+> Code: [ \n\r\t]* Code: </[^>]+> Last edited by mzmm; 01-12-2015 at 11:09 AM. | ||
|   |   | 
|  01-12-2015, 11:09 AM | #456 | |
| Resident Curmudgeon            Posts: 80,727 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | Quote: 
 Take a look at the following line... <p><span>This is some text.<span class="smallcaps">THIS IS MORE TEXT</span>. This is yet more text.</span> And finally the last bit of text.</p> Can you use regex to get rid of the empty span without messing up the span that actually does something? I don't see how you can. | |
|   |   | 
|  01-12-2015, 11:11 AM | #457 | 
| 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) | 
			
			Didn't notice you found a solution. Note that mine should find html entity nbsp's as well. Additionally, it makes sense to ensure the two tags match, which I have done. Last edited by eschwartz; 01-12-2015 at 11:16 AM. | 
|   |   | 
|  01-12-2015, 11:14 AM | #458 | |
| 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: 
 | |
|   |   | 
|  01-12-2015, 12:58 PM | #459 | 
| Groupie            Posts: 173 Karma: 40000 Join Date: Oct 2013 Device: kindle | |
|   |   | 
|  01-12-2015, 01:17 PM | #460 | 
| Groupie            Posts: 171 Karma: 86271 Join Date: Feb 2012 Device: iPad, Kindle Touch, Sony PRS-T1 | 
			
			had some trouble pasting this in, but anyway, it's fixed Code: (?s)<p[^>]*?>\s*?(?:<\w[^>/]*?>)*?\s*?(?: |<br(?:\s|\s/|/)?>)*?\s*?(?:</\w[^>/]*?>)*?\s*?</p> Last edited by mzmm; 01-12-2015 at 01:21 PM. | 
|   |   | 
|  01-12-2015, 02:25 PM | #461 | 
| Groupie            Posts: 173 Karma: 40000 Join Date: Oct 2013 Device: kindle | 
			
			hmm still doesn't work. Only finds the tags with   inside.
		 Last edited by 1v4n0; 01-12-2015 at 03:21 PM. | 
|   |   | 
|  01-12-2015, 03:44 PM | #462 | 
| 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) | 
			
			Use mine. It will remove matched tag pairs with no content or containing only a space or html entity space. regex is not a programming language. The appropriate way to remove multiple nested sets is by repeating the Replace All until there are none left. | 
|   |   | 
|  01-12-2015, 04:06 PM | #463 | 
| Resident Curmudgeon            Posts: 80,727 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | 
			
			There is an empty span set. It's the span that does nothing. The other span does something so it's not empty. But regex will not recognize which </span> is the closing for empty span.
		 | 
|   |   | 
|  01-12-2015, 04:11 PM | #464 | |
| 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 is also worth pointing out that the span tag *can* be styled without attributes. Which would be the only reason to have an attributeless span tag anyway.   | |
|   |   | 
|  01-23-2015, 12:24 PM | #465 | 
| Groupie            Posts: 171 Karma: 86271 Join Date: Feb 2012 Device: iPad, Kindle Touch, Sony PRS-T1 | 
			
			works for me in Sigil it matches <p></p> <p><br/></p> <p><span><br/> </span></p> <p><i><b><br /> </b></i></p> ... but not when the tags are unevenly distributed, as in <p><i> </i><span></span></p> anyway. grave-digging threads here... | 
|   |   | 
|  | 
| Thread Tools | Search this Thread | 
| 
 | 
|  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 |