Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 11-10-2016, 12:36 AM   #1
ksimpson1986
Member
ksimpson1986 began at the beginning.
 
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?
ksimpson1986 is offline   Reply With Quote
Old 11-10-2016, 01:44 AM   #2
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
You almost got it. Use:

Code:
\((.*?)\)
Doitsu is offline   Reply With Quote
Advert
Old 11-10-2016, 01:50 AM   #3
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by ksimpson1986 View Post
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?
You forgot to capture the text within parentheses:

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.
Tex2002ans is offline   Reply With Quote
Old 11-10-2016, 01:54 AM   #4
ksimpson1986
Member
ksimpson1986 began at the beginning.
 
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.
ksimpson1986 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 04:39 AM.


MobileRead.com is a privately owned, operated and funded community.