11-10-2016, 12:36 AM | #1 |
Member
Posts: 14
Karma: 10
Join Date: Oct 2016
Device: ibooks
|
regex parenthesis text formatting question!
I feel like this should be cake, but i'm still learning regex...i have 900 greek index words, each having an English translation in parentheses next to it. I need a way to search and replace all words inside the parentheses on the page and italicize them. doing some research, I've found a few suggestions, but nothing that worked for me.
my example: adikeo (hurt) needs to be: adikeo (hurt) i found the regex code, \(.*?\) this definitely works in finding all the words i need, but i can't figure out the replace code with keeping the english word inside...i feel like (<em>\1</em>) should be working? but it just gives me an italicized "1"...any suggestions? |
11-10-2016, 01:44 AM | #2 |
Grand Sorcerer
Posts: 5,635
Karma: 23190435
Join Date: Dec 2010
Device: Kindle PW2
|
You almost got it. Use:
Code:
\((.*?)\) |
Advert | |
|
11-10-2016, 01:50 AM | #3 | |
Wizard
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
Search: \((.*?)\) Replace: (<i>\1</i>) You matched the parentheses themselves by using the escaped RED \( \), but forgot to add the actual "capture" parentheses BLUE ( ). And make sure you save a copy before you Replace using this. |
|
11-10-2016, 01:54 AM | #4 |
Member
Posts: 14
Karma: 10
Join Date: Oct 2016
Device: ibooks
|
Thank you guys so much!! that worked perfectly! ill get regex down eventually. all the slashes and parenthesis can be a little overwhelming.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Text formatting issues when creating IDs/hyperlinking text | rnuss | Sigil | 2 | 09-28-2013 06:49 AM |
Image With Text Formatting Question | jackibar | ePub | 4 | 02-19-2013 02:18 PM |
Is it possible to avoid the numbers between parenthesis in the folder name of a book? | superplinio | Calibre | 5 | 11-08-2009 09:52 PM |
line formatting formatting question | daesdaemar | Workshop | 9 | 02-06-2009 11:47 AM |
Text tool for formatting Gutenberg text files | bob_ninja | Workshop | 5 | 11-13-2007 12:28 PM |