#include <Array.au3>
$string = "123 Happy Lane New York City NY 100219809"
$aStr = stringsplit($string, " ")
$aStr[$aStr[0] - 2] = $aStr[$aStr[0] - 2] & ","
If stringlen($aStr[$aStr[0]]) = 9 Then
If StringInStr($aStr[$aStr[0]] , "-") = 0 Then $aStr[$aStr[0]] = stringleft($aStr[$aStr[0]] , 5) & "-" & stringright($aStr[$aStr[0]] , 4)
Endif
for $i = 1 to $aStr[0]
If $aStr[$i] = "Lane" Then $aStr[$i] = $aStr[$i] & ","
Next
$sFrmt = _ArrayToString ($aStr , " " , 1)
msgbox(0 , '' , $sFrmt)
Some will have set positions, but you will have to account for all the ways people write street names Court, Crt, Ct., etc... in the loop, as that will be the only way I can think of to discern where the address stops and city begins. You can assume the zip will be last, the state second to last.
edit: tried to wrap the 9 digit in an if statement and boned the formatting of the post...but at least its not all ugly on 5 digit zips now.