AutoHotkey Community

It is currently May 27th, 2012, 1:40 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: January 15th, 2010, 6:41 am 
Offline

Joined: November 26th, 2008, 4:16 pm
Posts: 32
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 15th, 2010, 7:12 am 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
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")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 15th, 2010, 7:19 am 
Offline

Joined: November 26th, 2008, 4:16 pm
Posts: 32
jaco0646,

Thank you friend! This will help immensely!!
Works as expected :D


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: bobbysoon, iDrug, JSLover, Tipsy3000, Yahoo [Bot] and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group