AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Regex assistance with US zip codes

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
bqw371



Joined: 26 Nov 2008
Posts: 32

PostPosted: Fri Jan 15, 2010 5:41 am    Post subject: Regex assistance with US zip codes Reply with quote

Hi all. I need assistance creating a regex to remove commas that should not have been entered into number sets (U.S. zip codes).

,11778, - This is a valid zip code within a CSV file.
,1,0566, - Invalid - Should be ,10566,
,30,052, - Invalid - Should be ,30052,
,113,61, - Invalid - Should be ,11361,
,1177,8, - Invalid - Should be ,11778,

Any help would be appreciated
Back to top
View user's profile Send private message
jaco0646



Joined: 07 Oct 2006
Posts: 3113
Location: MN, USA

PostPosted: Fri Jan 15, 2010 6:12 am    Post subject: Reply with quote

Code:
var =
(
,11778, - This is a valid zip code within a CSV file.
,1,0566, - Invalid - Should be ,10566,
,30,052, - Invalid - Should be ,30052,
,113,61, - Invalid - Should be ,11361,
,1177,8, - Invalid - Should be ,11778,
)
MsgBox,% RegExReplace(var,"(,\d{1,4}),","$1")
Back to top
View user's profile Send private message Visit poster's website
bqw371



Joined: 26 Nov 2008
Posts: 32

PostPosted: Fri Jan 15, 2010 6:19 am    Post subject: Reply with quote

jaco0646,

Thank you friend! This will help immensely!!
Works as expected Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group