Add normal pattern match algorithm, tested.