this is a german Web-Mirror of MHONARC.ORG powered by Domainunion AG

xsl-list
[Top] [All Lists]

Re: [xsl] one for the regex gods

2013-07-08 19:05:46
On Tue, Jul 9, 2013 at 12:35 AM, Imsieke, Gerrit, le-tex
<gerrit(_dot_)imsieke(_at_)le-tex(_dot_)de> wrote:


On 09.07.2013 01:05, Ihe Onwuka wrote:

I have this regex

<!-- remove commas embedded in amounts-->
<!-- also replace multiple hyphens with asterisks -->
<xsl:variable name="line"

select="replace(replace(.,'-{2,}','**********'),'(,(\d{3})+(\D|$))','$2')"/>


Have you considered using '$2$3' as the outer replacement?


Ah hah! That did the trick.

But I’m wondering whether the regex is really intended as it is written
here. If you are trying to replace repeating groups of (,(\d{3})) with each
$2, it should be more like (,(\d{3}))+ instead of (,(\d{3})+…)


food for future consumption... I am going with instant gratification.

--~------------------------------------------------------------------
XSL-List info and archive:  https://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: https://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>