[Home] [By Thread] [By Date] [Recent Entries]
Hi Mark,
I first tried this regex: ((\w+\s+)+)(\w+)(\s+[JS]r)? But its inherent greediness would always put [JS]r in the (\w+) group, considering it as the last name. So maybe split this up into two analyze-string passes (or replacements, donbt necessarily need to use analyze-string): <xsl:analyze-string select="." regex="\s+([JS]r)\s*$">
<xsl:matching-substring>
<xsl:text> (</xsl:text>
<xsl:value-of select="regex-group(1)"/>
<xsl:text>)</xsl:text>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:analyze-string select="." regex="(.+?)\s+(\w+)\s*$">
<xsl:matching-substring>
<xsl:value-of select="regex-group(2)"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="regex-group(1)"/>
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:non-matching-substring>
</xsl:analyze-string>How do you intend to deal with multiple surname components? The way your examples are structured, only multiple first names may occur, while the last name is always expected to match \w+ (no spaces in between). Gerrit On 2012-11-06 00:45, Mark wrote: This must have been done many times, so can some one show me where to find the answer?
Registergericht / Commercial Register: Amtsgericht Leipzig Registernummer / Registration Number: HRB 24930 GeschC$ftsfC<hrer: Gerrit Imsieke, Svea Jelonek, Thomas Schmidt, Dr. Reinhard VC6ckler
|

Cart



