Skip to main content
Known Participant
April 24, 2018
Answered

Wildcard question please

  • April 24, 2018
  • 1 reply
  • 896 views

I have a bunch of footnotes that appear in the the text and source code as and [iv] and [xxiii], etc.   I don't need them to link anywhere.

But I do want to superscript them.

So I need a way to search the source code for [anything] and replace it with <sup>[anything]</sup>.  

So any time my code contains left-bracket, any character(s), right bracket...that code stays the same except for <sup> before it and </sup> after it.

I am getting confusing with my syntax involving the brackets.   thanks !

    This topic has been closed for replies.
    Correct answer WolfShade

    Wow, thanks so much.   That was close, but it's putting the sup tags around the whole P tags, but I only need it around the bracketed info.

    So my code is like this:

    <p>This is a sentence[vii] </p>

    What I want is:

    <p>This is a sentence<sup>[vii]</sup> </p>

    And yours did this:

    <sup><p>This is a sentence[vii] </p><sup>


    Ah, I did misunderstand your request.

    In FIND: (<\s*p[^>]*>[^<]*)(\[\w+\]\s*)(<\s*\/\s*p\s*>)

    In REPLACE: $1<sup>$2</sup>$3

    HTH,

    ^ _ ^

    1 reply

    WolfShade
    Legend
    April 24, 2018

    Will the content always be between the same tags, every time?  <div> or <span> or <blockquote>?  Which?

    I'm sure a RegEx would be perfect for what you want to do.

    V/r,

    ^ _ ^

    ThomasLLLAuthor
    Known Participant
    April 24, 2018

    The content is always part of normal text paragraphs.  The only tags around them are <p></p>.

    RegEx does seem to be the way to go, but I can't quite get the context right on what to search for and replace with.

    WolfShade
    Legend
    April 24, 2018

    Lemme do some research.  I've got a RegEx that looks for HTML tags and strip them out without removing the content in between opening and closing tags.  I might be able to modify it for this purpose, but I need to look into something to see if it will work.

    V/r,

    ^ _ ^