In the first example, magnet isn't part of the domain. The domain is duckduckgo.com, no magnet in there. Pi-hole can't do anything ouside the domain, because it will never see that (not part of the query).
Use regex101: build, test, and debug regex to test your regexes.