Question: I'm using an imagePicker that enables me to select 4 images and creates an array of the selected. I want to set the images of 4 empty UIImageView with those 4 images that I have selected. Using the images array: images.first, I can set the the first empty UIImageView to the first image I select. I can also set another empty UIImageView using images.last to get the fourth selected image. 

How do I set the image of the empty UIImageViews the second and third image I have selected?

I am using "if let" checks for the first and last element of the array, but I don't know if it's possible to do "if let" checks for the second and third elements in order to prevent my application from crashing if I do not select four images.

```
    func doneButtonDidPress(_ imagePicker: ImagePickerController, images: [UIImage]) {

       let images = imageAssets

       if let imageOne = images.first {

        profileImageViewOne.image = imageOne

       }

       profileImageViewTwo.image = images[1]
       profileImageViewThree.image = images[2]

       if let imageFour = images.last {

        profileImageViewFour.image = imageFour

       }       

    }

```

Answer: 
The character set [^a-z] in your look ahead assertion may be too permissive, as it also includes the spaces between words. 

For emphasis you can try a test with the following:

```
\b(?=[A-Z0-9]*[a-z])(?=\D*\d)\w+\b

```
This is a very complex regex that has few small flaws that impact the results in a big way. One flaw, as @Anthony mentions,

> 
> The character set [^a-z] in your look ahead assertion may be too
>  permissive, as it also includes the spaces between words.
> 
> 
> 

Let's take a step back and look at the requirements.

So you want a regex to validate a string with a lower case letter and a number.
Let's go over all of the possible ways that these 2 conditions can be met.
There are 2 formats where this can be true (**RA denotes random alphanumeric characters**):

* RA + lowercase + RA + number + RA `(\w*[a-z]+\w*\d+\w*)`
* RA + number + RA + lowercase + RA `(\w*\d+\w*[a-z]+\w*)`

Now we just have to combine these into one regex separated by a `|`. It's a little long, but it gets the job done.

`\b(\w*[a-z]+\w*\d+\w*)|(\w*\d+\w*[a-z]+\w*)\b`