Simple, show your receipt and ID so police can check to see if you have affiliation with extremist group.
Of course, it's not going to be 100% effective, like any drug law. But still, there has to be some sort of legal restriction, negative reinforce on people's mind. After all, we are not talking petty criminal, but terrorists.
Than it would harder than drugs. Knives can be easily concealed. In case of drugs, police can get info from other sources, that this person had some dealing. In case of knives, even that is not possible. Second, in a preplanned terrorist attack, they can find ways to bypass the authorities. It might be more effective against petty criminals, who are not used to such sound planning - assuming that there is more brain behind terrorist attacks than spontaneous crimes.