Jump to content
UBot Underground

This one is hurting my face.


Recommended Posts

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

Link to post
Share on other sites

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.

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...