View Single Post
Old 01-25-2023, 11:59 AM   #4
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 786
Karma: 1538394
Join Date: Sep 2013
Device: Kobo Sage
Nope. Moving those tags from the middle of the word is harder than REmoving them. To move them, it looks like I'm back to needing to select the whole front and rear word fragments outside the tags. And, I haven't been able to do that yet.

EDIT: Let me stick some trials in here until I figure something out. First, the OR ("|") is giving me issues with the replacement strings. So, I'm just going to work with the non-self-terminated tags. Second, it looks like I can grab some form of the front/rear word fragments with
Code:
\b
:
Code:
SEARCH: (\b\w+?)(<[^/]+?></.?>)(\w+?\b)
REPLACE: \1\3\2
  1. 1st Capturing Group (\b\w+?)
    • \b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
    • \w matches any word character (equivalent to [a-zA-Z0-9_])
    • +? matches the previous token between one and unlimited times, as few times as possible, expanding as needed (lazy)
  2. 2nd Capturing Group (<[^/]+?></.?>)
    • < matches the character < with index 6010 (3C16 or 748) literally (case sensitive)
    • Match a single character not present in the list below [^/]
    • +? matches the previous token between one and unlimited times, as few times as possible, expanding as needed (lazy)
    • / matches the character / with index 4710 (2F16 or 578) literally (case sensitive)
    • ></ matches the characters ></ literally (case sensitive)
    • . matches any character (except for line terminators)
    • ? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
    • > matches the character > with index 6210 (3E16 or 768) literally (case sensitive)
  3. 3rd Capturing Group (\w+?\b)
    • \w matches any word character (equivalent to [a-zA-Z0-9_])
    • +? matches the previous token between one and unlimited times, as few times as possible, expanding as needed (lazy)
    • \b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
For the non-self-terminating-tag case, that seems to work fine.

Last edited by enuddleyarbl; 01-25-2023 at 05:04 PM.
enuddleyarbl is offline   Reply With Quote