View Single Post
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: 45,184
Karma: 168808723
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, 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