I need a regex that will be able to match AWS EC2 instance IDs. Instance IDs have the following criteria:
- Can be either 8 or 17 characters
- Should start with i-
- Followed by either a-f or 0-9
Valid instance IDs are: i-ed3a2f7a or i-096e0bec99b504f82 or i-0cad9e810fbd12f4f
Invalid instance IDs are e123g12 or i-1fz5645m
I was able to create the following regex i-[a-f0-9](?:.{7}|.{16})$ but it is also accepting i-abcdeffh. h is not between a-f
Grateful if someone could help me out