Subject: Re: [xsl] XPath 2.0 Regex misunderstanding From: Abel Braaksma <abel.online@xxxxxxxxx> Date: Fri, 19 Jan 2007 23:41:49 +0100 |
Thanks. I eventually figured out what I needed. I made the match alternatives more explicit and refreshed my memory on the grouping and alternation symbols, and I got something that worked for me.
After looking at your solution, I shortened it to this: not(matches(DATE,'^(0[1-9]|1[0-2])/([0-2]\d|3[01])/(2005|2006|2007)'))
That has over 70% fewer characters than my original expression, a welcome result.
I used to write a lot of text document parsing programs in Perl, and I was very sharp with regular expressions. I have gotten a bit rusty since then.
My requirement is that the date part of the field I am parsing be in this format "MM/DD/YYYY", with no skipped characters (that is to say, "01/05/2006" is perfect, while "1/5/06" should fail on three counts. I re-route the records with bad formats back to the data entry people to correct.
Whenever I think of writing regexes, my mind immediately goes to the "Obfuscated Perl Contest" that the Perl Journal used to sponsor.
Cheers, -- Abel Braaksma http://www.nuntia.nl
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Re: [xsl] XPath 2.0 Regex misun, cknell | Thread | [xsl] Separate same level elements , Spencer Tickner |
RE: [xsl] Separate same level eleme, Michael Kay | Date | Re: [xsl] Separate same level eleme, Spencer Tickner |
Month |