Add unit tests for `links_add_target()`. Alter the patterns in `links_add_target()` and `_links_add_target()` slightly based on learnings after running tests.

Props mdbitz.
Fixes #26164.



git-svn-id: https://develop.svn.wordpress.org/trunk@26328 602fd350-edb4-49c9-b593-d223f7449a82