#!/bin/perl
my $var = 'fhjgfghjk3456mm 735373653736 icasd 666666666666 111111111111';
if($var =~ m/(\d{12})/) {
print "Twelve digits: $1.";
}
Если я правильно понимаю ваш вопрос, вы можете сделать:
XSLT 2.0
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8" />
<xsl:template match="/Screenings">
<xsl:variable name="groups">
<xsl:for-each-group select="Screening" group-by="concat(@type, '-', @subtype)">
<group key="{current-grouping-key()}"/>
</xsl:for-each-group>
</xsl:variable>
<xsl:value-of select="$groups/group/@key" separator="|"/>
</xsl:template>
</xsl:stylesheet>
<час> Или просто:
<xsl:template match="/Screenings">
<xsl:value-of select="distinct-values(Screening/concat(@type, '-', @subtype))" separator="|"/>
</xsl:template>
Вы слишком усложняете процесс здесь? Я думаю, что вы можете просто использовать xsl:for-each-group
, чтобы получить нужные вам значения, без необходимости создавать строку, а затем разбивать ее.
<xsl:for-each-group select="Screening" group-by="@type">
<xsl:for-each-group select="current-group()" group-by="string(@subtype)">
<xsl:value-of select="concat('Processing ', @type, ' - ', @subtype, ' ')" />
</xsl:for-each-group>
</xsl:for-each-group>
Обратите внимание, что, если вы действительно хотите создать строку с разделителем в виде трубы, вы бы сделали это ...
<xsl:variable name="distinct" select="string-join(distinct-values(Screening/concat(@type, '-', @subtype)), '|')" />