Java's Pattern.match() method works that way. Python has two separate methods: re.match auto-anchors, re.search does not.