The approach is to use alternation to exactly match each target item in its literal form. Special regex metacharacters (such as . + ( ) [ ] and /) are escaped so that they match the corresponding characters in the target strings. This ensures that the regex only matches the given items and nothing else.