Best input method for 5 or 9 digit ZIP codes

I am designing a form where the client wants to required a 5 digit zip code, with 9 digits being optional. I can think of a couple ways to deal with this.

1) Just plain old regex accepting 5 digit codes, 9 digit codes, and formatted 9 digit codes (eg. 12345, 123456789, and 12345-6789)

2) Two side-by-side text boxes, the first for 5 digits and the second for the last 4 digits. side by side fields

Which pattern is more clear to the user? If it's the second pattern, how would I best indicate that the second field is optional?