Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You say:</p> <blockquote> <p>The aim is to replace these with my own custom wrapped acronym tags in a ColdFusion application I'm writing.</p> </blockquote> <p>It sounds like using XSL might be more appropriate than regex to transform one tag into another.</p> <p><strong>UPDATE:</strong></p> <p>Just threw this together, it seems to work for simple cases:</p> <p><em>(NOTE: this will simply strip out the 'acronym' tags. You could use XSL to replace them with your own custom tags, but you didn't specify anything along those lines so I didn't get into that)</em></p> <p>XSL:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:template match="*[name() = 'acronym']" /&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>Input:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;root&gt; This is some test text about &lt;acronym title="Incomplete Test Syndrome" class="CustomClass"&gt;ITS&lt;/acronym&gt; for the **ITS** department. Also worth mentioning ABS as well I guess.ITS, This is some **ITS** test text about &lt;acronym title="Incomplete Test Syndrome" class="GOTManager"&gt;ITS&lt;/acronym&gt; for the ITS department. Also worth mentioning ABS as well I guess &lt;/root&gt; </code></pre> <p>Output:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; This is some test text about for the **ITS** department. Also worth mentioning ABS as well I guess.ITS, This is some **ITS** test text about for the ITS department. Also worth mentioning ABS as well I guess </code></pre> <p><strong>UPDATE:</strong></p> <p>You said:</p> <blockquote> <p>So in the first example I want it to ignore the wrapped ITS and give me the ITS at the end of the 1st sentence.</p> <p>In the second example I want it to return the ITS at the start of the 2nd sentence.</p> </blockquote> <p>This makes no sense. Your second example doesn't have "ITS" in the second sentence. I <em>think</em> what you meant was that the <code>**ITS**</code> is what you want to have extracted.</p> <p>The XSL sample I gave only strips the <code>&lt;acronym/&gt;</code> tags, but after that's done you can try to find the <code>ITS</code> at different points in the sentence and maybe for that a regex might be easy (this assumes that you're ONLY have to worry about the <code>&lt;acronym/&gt;</code> tags).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload