|  05-12-2014, 04:51 PM | #1 | 
| New old guy  Posts: 69 Karma: 10 Join Date: Feb 2012 Device: kindle fire | 
				
				Regex?
			 
			
			Am trying hard to learn enough about Regex to where it can be of some help to me.  I pretty much got the hang of building some useful simple expressions, but have reached the point where I need some help.   The Regex tutorial is really great; but it talks about a "Regex Wizard" and a "Regex Test Button" -- both of which would be very helpful -- but I can't find them. Also,the tutorial provides excellent instruction on using a regex in the 'find' box, but nothing about how to develop a regex for the 'replacement' box. For instance, I would like to find certain strings with specific opening and closing tags, each of which have various strings between them, and replace the open and closing tags but preserving what is included between them. Just a little kick in the right direction should do it. | 
|   |   | 
|  05-12-2014, 05:10 PM | #2 | 
| Color me gone            Posts: 2,089 Karma: 1445295 Join Date: Apr 2008 Location: Central Oregon Coast Device: PRS-300 | 
			
			Some of what you want to do will, I believe take a scripting function that doesn't exist yet, but is planned. As I understand the capabilities, you can put chunks of the find into replace, but you can't change them. However, you don't have to do everything in one super regex. It can be safer to figure out what you want to do in chunks and check the result at each stage. | 
|   |   | 
|  05-12-2014, 08:56 PM | #3 | 
| stumblebum  Posts: 29 Karma: 10 Join Date: Nov 2013 Location: Roseburg, OR Device: kindle2 | 
			
			@weberr The features the tutorial are talking about are Convert Books >Search and Replace, at the left. That is the 'old' way to do search and replace. The 'new' way is on the right click 'Edit Book' in the context menu in the main page of Calibre. The 'old' way was before Kovid came out with the 'Edit Book' feature. And the tutorial was written before the Edit Book feature. Edit Book is way easier because you can watch it work, and you can tell instantly whether you screwed up the regex. Or not.  As to regexs, try the one that Kovid gave me below. Sorry, I don't know how to give you a link to that thread in this forum. Just look for 'stumblebum'. Am I right when I am assuming you would like to get rid of a closing tag (</p>) and then the following opening tag? Since you are playing with regexs, you probably have an idea what you are doing. It is a good one. You can fine tune it for you want to do. Just don't hit 'Replace All' until you're sure that is what you want. (learned from experience)  Hope this helps, larry Last edited by timberbeast; 05-12-2014 at 09:07 PM. Reason: didn't know down from up | 
|   |   | 
|  05-12-2014, 09:06 PM | #4 | 
| Grand Sorcerer            Posts: 28,882 Karma: 207000000 Join Date: Jan 2010 Device: Nexus 7, Kindle Fire HD | |
|   |   | 
|  | 
| Tags | 
| regex | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Regex help anyone? | seanos | Editor | 17 | 04-02-2014 11:03 AM | 
| Need help with a regex | mobiuser | Workshop | 15 | 01-19-2014 05:57 PM | 
| Help with some regex | Chaos_Therum | Library Management | 1 | 12-28-2013 11:20 AM | 
| Regex help | paulfiera | Sigil | 4 | 06-14-2012 07:55 AM | 
| regex help please | thevoiceofcheese | Calibre | 2 | 08-01-2011 11:27 PM |