search: extract pattern type with regex instead of the parse tree
Created by: rvantonder
Addresses #6314 (closed). Not happy with a regex approach, but it's a compromise until we can do this in a principled way with a literal parser.
Test plan: Yes