Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 05-01-2013, 01:51 PM   #1
dwlamb
Member
dwlamb began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Apr 2013
Device: Android Smartphone
search and replace on phrase

I am undertaking a conversion from an export of an odt file and wish to do a regular expression search and replace of strings of words individually italicised instead of the entire phrase.

I have
Code:
<i>something</i> <i>like</i> <i>this</i>

and want

<i>something like this</i>
I came up with this
Code:
<i>(.*)</i>\s<i>(.*)</i>\s
but at times it is too greedy, trapping
Code:
<i>something</i> <i>like</i> <i>this</i> blah blah. More words and then <i>another</i> <i>string</i> <i>in</i> <i>italics</i>
Any ideas would be most welcome for how to write the search string and not trap a large block in between phrases

Last edited by dwlamb; 05-01-2013 at 02:12 PM. Reason: clarity
dwlamb is offline   Reply With Quote
Old 05-01-2013, 02:13 PM   #2
BobC
Guru
BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.
 
Posts: 691
Karma: 3026110
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro +
Would a simple S&R on </i> <i> replaced by a space not do what you want.

i.e get rid of the adjacent end and start italic tags.

Don't even need regex !

BobC
BobC is offline   Reply With Quote
Advert
Old 05-01-2013, 02:13 PM   #3
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,583
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by dwlamb View Post
I have
Code:
<i>something</i> <i>like</i> <i>this</i>

and want

<i>something like this</i>
How about searching for </i> <i> and replacing it with a space?
Doitsu is offline   Reply With Quote
Old 05-01-2013, 05:09 PM   #4
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,093
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
That's what I use.
</i> <i> => {space}
</i>, <i> => ", "
</i>. <i> => ". "
Turtle91 is offline   Reply With Quote
Old 05-01-2013, 06:11 PM   #5
dwlamb
Member
dwlamb began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Apr 2013
Device: Android Smartphone
*sigh* Sometimes we get so close to the forest we can not see the trees.

Thanks for the help one and all.
dwlamb is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
search for a file, a word or a phrase GKj Onyx Boox 0 12-21-2012 05:55 AM
Search and Replace SOThunder Conversion 2 04-29-2012 08:29 AM
Search and replace TdeV Sigil 1 10-30-2011 04:45 PM
search and replace - drops blanks in replace ? cybmole Conversion 10 03-13-2011 03:07 AM
Search and replace in 0.2.0 paulpeer Sigil 7 03-13-2010 11:59 AM


All times are GMT -4. The time now is 05:21 PM.


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