Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 11-05-2016, 11:38 PM   #1
ksimpson1986
Member
ksimpson1986 began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Oct 2016
Device: ibooks
New to regex find and replace!

i'm sure for some people this is cake, i just have no clue how to get this regex to work correctly. i have 1000 snippets of code that look like this:

<p class="indent-arrow"><span class="_idGenBNMarker-1" lang="en-US" xml:lang="en-US" xmlns:xml="http://www.w3.org/XML/1998/namespace">1. </span>A BUNCH OF DIFFERENT TEXT FOR EACH OF THE 1000 POSTS</p>

I need to change the beginning and ending text to this without harming the text for each post:

<p class="bullists"><span>1. </span><span class="CharOverride-5">A BUNCH OF DIFFERENT TEXT FOR EACH OF THE 1000 POSTS</span></p>

i found a snippet of code earlier that showed i can place (.+?) in place of the post text in the search box. It successfully caused the search to find and highlight every single post perfectly, but it doesn't replace correctly. instead it replaces the post text with (.+?) ...i'm so close, but i know i'm missing something. can anyone help please???
ksimpson1986 is offline   Reply With Quote
Old 11-06-2016, 03:08 AM   #2
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,464
Karma: 145525534
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by ksimpson1986 View Post
i'm sure for some people this is cake, i just have no clue how to get this regex to work correctly. i have 1000 snippets of code that look like this:

<p class="indent-arrow"><span class="_idGenBNMarker-1" lang="en-US" xml:lang="en-US" xmlns:xml="http://www.w3.org/XML/1998/namespace">1. </span>A BUNCH OF DIFFERENT TEXT FOR EACH OF THE 1000 POSTS</p>

I need to change the beginning and ending text to this without harming the text for each post:

<p class="bullists"><span>1. </span><span class="CharOverride-5">A BUNCH OF DIFFERENT TEXT FOR EACH OF THE 1000 POSTS</span></p>

i found a snippet of code earlier that showed i can place (.+?) in place of the post text in the search box. It successfully caused the search to find and highlight every single post perfectly, but it doesn't replace correctly. instead it replaces the post text with (.+?) ...i'm so close, but i know i'm missing something. can anyone help please???
search: (.*?) is the wildcard search, \ is an escape character for the . which I only did for the . after the bullet number

Code:
<p class="indent-arrow"><span class="_idGenBNMarker-1" lang="en-US" xml:lang="en-US" xmlns:xml="http://www.w3.org/XML/1998/namespace">(.*?)\. </span>(.*?)</p>
replace: (\1 is the first search result, \2 is the second, etc.)

Code:
<p class="bullists"><span>\1. </span><span class="CharOverride-5">\2</span></p>
You might also check the regex examples in the sticky ( Regex Examples ).

Last edited by DNSB; 11-06-2016 at 03:19 AM.
DNSB is offline   Reply With Quote
Advert
Old 11-06-2016, 11:29 AM   #3
ksimpson1986
Member
ksimpson1986 began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Oct 2016
Device: ibooks
Thank you so much!! this worked perfectly!
ksimpson1986 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
regex cannot find to replace eschwartz Editor 11 02-03-2014 11:00 PM
Regex find and replace SanatyrZeo Sigil 5 10-29-2012 07:03 AM
Regex Find and Replace - Spaces essayhead Sigil 2 08-10-2012 07:41 PM
RegEx find and replace iblesq Sigil 1 01-10-2011 09:26 PM
REGEX find and replace help please potestus Sigil 13 09-18-2010 04:14 PM


All times are GMT -4. The time now is 11:52 AM.


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