We have following kinds of data, which have totally unexpected
patterns. Can anyone suggest me the conditional way to write the
regular expression. It should not delete any kind of data if it is
not matching exactly. As we have seen below that some portion of
third name is getting deleted.
Input
<span class="name">Axxx B.</span>
<span class="name">B. Axxx</span>
<span class="name">xxx C. Dxxx</span>
<span class="name">Exxx-Exxx</span>
XSL
<xsl:analyze-string select="."
regex="([A-Z][A-Z|a-z|\-|#]+)(,)?\s+([A-Z|\.]+)+">
<au>
<xsl:matching-substring>
<s><xsl:value-of select="regex-group(1)"/></s>
<xsl:value-of select="regex-group(2)"/><xsl:text> </xsl:text>
<f><xsl:value-of select="regex-group(3)"/></f>
</xsl:matching-substring>
</au>
</xsl:analyze-string>
<xsl:analyze-string select="."
regex="([A-Z|\.]+)(,)?\s+([A-Z][A-Z|a-z|\-|#]+)">
<au>
<xsl:matching-substring>
<f><xsl:value-of select="regex-group(1)"/></f>
<xsl:value-of select="regex-group(2)"/><xsl:text> </xsl:text>
<s><xsl:value-of select="regex-group(3)"/></s>
</xsl:matching-substring>
</au>
</xsl:analyze-string>
Output
<au><s>Axxx</s> <f>B.</f></au>
<au><f>B.</f> <s>Axxx</s></au>
<au><f>C.</f> <s>Dxxx</s></au> <!--xxx is deleted-->
<au/> <!-- text is deleted-->
Any clue in this regard will be highly appreciable!!!
...JSR
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--