[ Date Index ][
Thread Index ]
[ <= Previous by date /
thread ]
[ Next by date /
thread => ]
On Sat, 11 May 2002, Adrian Midgley wrote:
NHS Numbers are 10 digits. The canonical formatting of them is 999 999 9999 However often they are present as 9999999999
There are many ways to do it. The simplest is to match digits ( [0-9] , or \d in Perl or pcre) with optional spaces. The spaces could in turn use a whitespace wildcard (such as Perl's \s), and you can make the whole thing more concise if you care to RTFM.
values in ""
So you want to match "" In Perl, that's /\"(\d{3}\s?\d{3}\s?\d{4})\"/ for a simple match, or /\"(\d{3})\s?(\d{3})\s?(\d{4})\"/ to read it into three separate numeric fields in canonical form. In V8 or Posix you'd need something a bit more verbose like [0-9] for \d.
I'm converting an application from VB with an Acess database into something else, possibly Python/TCL interface working the usual underpinnings.
I think Python groks Perl-like regexps, but not 100% sure. -- Nick Kew Available for contract work - Programming, Unix, Networking, Markup, etc. -- The Mailing List for the Devon & Cornwall LUG Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the message body to unsubscribe.