Hi is there a way to block incoming traffic using regular expressions in nginx?

For example, if a state has asp or swf or php in the last segment of the url (www.ananth.swf) can this be blocked or directed to a black hole?