Suggestion on how to check if space exists in an address between the street number and street name

We’re having trouble with customers giving us an address missing a space between the street number and name. Address validation can be very complicated, I am not trying to validate an entire address, just fix this one issue before passing it to an address validation API.

The first line of an address should look like this:

123 Main St.

We’re getting addresses from customers where the first space is missing:

123Main St.

A valid address could look like these and shouldn’t get a space injected:

123A Main St.
123-A Main St.

I think a regex would work to detect this, and I could use the split block to break the address apart, add a space, and put it back together.

I asked ChatGPT and got a lot of solutions that didn’t work

The simplest approach, which would cover the majority of the cases would be to iterate over the characters in the string and split the numeric portion in the head from the rest. However, that approach would not work for cases when there is a letter that is a part of the street number, such as 123AMain St