slash30 2 Posted September 18, 2010 Report Share Posted September 18, 2010 Ok so I'm scraping an address like "888 Transgender Dr. Stage Coach, NV 99999". I'd like to insert or replace the space with a comma between the state and the zipcode to make it an additional column in the csv file. I was thinking along the lines of a regex like "s/(.+\b[A-Z]{2})\s([0-9]{5})/$1,$2/g" and do a replace but I don't think that works in ubot. Any ideas? Thanks. TJ Quote Link to post Share on other sites
IRobot 43 Posted September 18, 2010 Report Share Posted September 18, 2010 Ok so I'm scraping an address like "888 Transgender Dr. Stage Coach, NV 99999". I'd like to insert or replace the space with a comma between the state and the zipcode to make it an additional column in the csv file. I was thinking along the lines of a regex like "s/(.+\b[A-Z]{2})\s([0-9]{5})/$1,$2/g" and do a replace but I don't think that works in ubot. Any ideas?Regular expressions should work, see the tutorial here: www.regular-expressions.info/tutorial.html Another solution would be:1. $add to list.2. $list from text, using the comma as a delimiter.3. The remaining string would contain the state and zip code. Repeat 1. Repeat 2, using space as a delimiter. 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.