[ Date Index ][
Thread Index ]
[ <= Previous by date /
thread ]
[ Next by date /
thread => ]
On Sat, May 11, 2002 at 06:19:59PM +0000, Adrian Midgley wrote:
The canonical formatting of them is 999 999 9999 However often they are present as 9999999999
I am always amazed by the cleverness of people who can produce regexps such as one that would enable me to grep all lines out of a big text (csv, values in "") file which contain a specific NHS number regardless of which format it is presented in...
Do you want to ... a) convert the file to cannonical form? perl -pi.bak -e 's/"(\d{3})(\d{3})(\d{4})"/"$1 $2 $3"/g' test.csv test2.csv OR ... b) reformat them in the code, irrespective of the format $number = mygetfield(); $number =~ s/(\d{3})\s?(\d{3})\s?(\d{4})/$1 $2 $3/; OR .. c) let them be formatted in any olf format and still find them $number = mygetfield(); $number =~ s/\D//g; $number =~ s/(\d{3})(\d{3})(\d{4})/$1 $2 $3/;
I'm converting an application from VB with an Acess database into something else, possibly Python/TCL interface working the usual underpinnings.
How about perl/tk? Steve -- The Mailing List for the Devon & Cornwall LUG Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the message body to unsubscribe.