LPM: regex question --

Janine Ladick janine.ladick at fetterprinting.com
Tue Dec 14 12:00:00 CST 1999


Why not use split and join instead of regular expressions?  You 
could check for double quotes at the beginning/end of each piece 
returned by split to ensure that your join goes the way you want.  Or 
maybe just split on ", and join on "; - I think that might do it.

Janine



Date sent:      	Tue, 14 Dec 1999 12:39:27 -0500
To:             	lexington-pm-list at happyfunball.pm.org
From:           	David Hempy <hempy at ket.org>
Subject:        	Re: LPM: regex question --
Send reply to:  	lexington-pm-list at happyfunball.pm.org

> At 11:06 AM 12/14/1999 -0600, you wrote:
> >I need to replace something like:
> >
> >"one","two","three","four,five","six"
> >
> >with 
> >
> >"one";"two";"three";"four,five";"six"
> 
> I'm new at this, so I'll jump in early.  That way, the pros can correct me
> or show me up after the fact.  ;-)
> 
> This should work, if you know the input is going to be well behaved:
> 
> 	s/","/";"/g;
> 
> (I don't think you have to escape the quotes, but I haven't actually tested
> it.) 
> If ever got "one",",","two" you'd be in trouble.  (I think)
> 
> I'm eager to see a more robust solution.
> 
> -dave
> 
> 
> --
> David Hempy
> Internet Database Administrator
> Kentucky Educational Television
> 





More information about the Lexington-pm mailing list