Well, if you really want to know, just continue your quoted verse one more sentence, you’ll clearly see that Jesus was speaking of the Ten Commandments. You quoted Mathew 5:17–18. He then goes on to describe the unrighteousness of the Pharisees and teachers of the law.
19–20:
“Anyone who breaks one of the least of these commandments and teaches others to do the same will be called least in the kingdom of heaven, but whoever practices and teaches these commands will be called great in the kingdom of heaven. 20For I tell you that unless your righteousness surpasses that of the Pharisees and the teachers of the law, you will certainly not enter the kingdom of heaven.
Jesus was specifically separating the Ten Commandments from The Law of Moses. ”these commandments” and ”the law” are clearly distinguished apart from one another. The Pharisees and teachers of the law were corrupt, and pointing out their corruption was the real reason Jesus was killed. He threatened their power hold.
Read further and he specifically goes into detail about both the Ten Commandments (expanding upon them), and the Law of Moses (rejecting them as sufficient for salvation, in that they were legal documents rather than spiritually beneficial). It is up to the reader to determine which is which. Such is the nature of Jesus’ teachings. They were not meant to be taken out of context and used to hurl scriptures at one another. He mixed them up so that only the those who actually read and study the entire scriptures in context could make any real sense out of them. All others toss them about foolishly to support a particular agenda.
He begins with two of the Ten Commandments, in support.
Murder
21–26:
21“You have heard that it was said to the people long ago, ‘Do not murder,[a] and anyone who murders will be subject to judgment.’ 22But I tell you that anyone who is angry with his brother[b]will be subject to judgment. Again, anyone who says to his brother, ‘Raca,[c]’ is answerable to the Sanhedrin. But anyone who says, ‘You fool!’ will be in danger of the fire of hell.
23“Therefore, if you are offering your gift at the altar and there remember that your brother has something against you, 24leave your gift there in front of the altar. First go and be reconciled to your brother; then come and offer your gift.
the Pharisees would have settled for the gift, and not concerned themselves with the forgiveness
25“Settle matters quickly with your adversary who is taking you to court. Do it while you are still with him on the way, or he may hand you over to the judge, and the judge may hand you over to the officer, and you may be thrown into prison. 26I tell you the truth, you will not get out until you have paid the last penny.
Adultery
27–30:
27“You have heard that it was said, ‘Do not commit adultery.’[e] 28But I tell you that anyone who looks at a woman lustfully has already committed adultery with her in his heart. 29If your right eye causes you to sin, gouge it out and throw it away. It is better for you to lose one part of your body than for your whole body to be thrown into hell. 30And if your right hand causes you to sin, cut it off and throw it away. It is better for you to lose one part of your body than for your whole body to go into hell.
_____________
See the pattern? Jesus is concerned with sins of the heart. For that alone is what kills the spirit.
_____________
The next verse, still on adultery, he addresses the Law of Moses as a physical document concerned with legality, but expands the notion to indicate what that means to the spirit.
31–32:
31“It has been said, ‘Anyone who divorces his wife must give her a certificate of divorce.’[f] 32But I tell you that anyone who divorces his wife, except for marital unfaithfulness, causes her to become an adulteress, and anyone who marries the divorced woman commits adultery.
Taking the Lord’s name in vain (Most people consider this as simple swearing. But it’s actually much deeper than that. It includes keeping your word and honoring your oaths, which is different from lying or bearing false witness. Saying “God is my witness” is just as erroneous as saying “God Damn It”. This is played out in modern courtrooms to this day. The foundational principle of lying under an oath made to God.)
33–37:
33“Again, you have heard that it was said to the people long ago, ‘Do not break your oath, but keep the oaths you have made to the Lord.’ 34But I tell you, Do not swear at all: either by heaven, for it is God’s throne; 35or by the earth, for it is his footstool; or by Jerusalem, for it is the city of the Great King. 36And do not swear by your head, for you cannot make even one hair white or black. 37Simply let your ‘Yes’ be ‘Yes,’ and your ‘No,’ ‘No’; anything beyond this comes from the evil one.
Then Jesus specifically rejects a Law of Moses
.
38–42:
38“You have heard that it was said, ‘Eye for eye, and tooth for tooth.’[g] 39But I tell you, Do not resist an evil person. If someone strikes you on the right cheek, turn to him the other also. 40And if someone wants to sue you and take your tunic, let him have your cloak as well. 41If someone forces you to go one mile, go with him two miles. 42Give to the one who asks you, and do not turn away from the one who wants to borrow from you.
And Continues to reject…
43–48:
43“You have heard that it was said, ‘Love your neighbor[h] and hate your enemy.’ 44But I tell you: Love your enemies[i] and pray for those who persecute you, 45that you may be sons of your Father in heaven. He causes his sun to rise on the evil and the good, and sends rain on the righteous and the unrighteous. 46If you love those who love you, what reward will you get? Are not even the tax collectors doing that? 47And if you greet only your brothers, what are you doing more than others? Do not even pagans do that? 48Be perfect, therefore, as your heavenly Father is perfect.
______________
It goes on and on comparing the Ten Commandments to the Law of Moses, ending with Mathew 7:28–29:
28When Jesus had finished saying these things, the crowds were amazed at his teaching, 29because he taught as one who had authority, and not as their teachers of the law.
_________________
There are other scriptures where Jesus separates himself and his teachings from the Law of Moses. For instance, when Jesus was to be stoned by the Pharisees, he asked them why. They said it was for blasphemy (against the Law), in which Jesus answered them in John 10:34:
34Jesus answered them, “Is it not written in your Law, ‘I have said you are gods’[e]?
“Your Law”… not God’s Law, not Our Law, not The Law.
In Mark 1:1–12 Jesus was asked specifically about the Law. And he contrasted the Law of Moses against the Law of God, relating it to his commandment on adultery.
“And the Pharisees came to him, and asked him, Is it lawful for a man to put away his wife? tempting him. And he answered and said unto them, What did Moses command you? And they said, Moses suffered to write a bill of divorcement, and to put her away. And Jesus answered and said unto them, For the hardness of your heart he wrote you this precept. But from the beginning of the creation God made them male and female. For this cause shall a man leave his father and mother, and cleave to his wife; And they twain shall be one flesh: so then they are no more twain, but one flesh. What therefore God hath joined together, let not man put asunder. And in the house his disciples asked him again of the same matter. And he saith unto them, Whosoever shall put away his wife, and marry another, committeth adultery against her. And if a woman shall put away her husband, and be married to another, she committeth adultery.” —Mark 1:1–12
___________________
There are too many misunderstandings about Christianity. They come from both Christians and Atheists alike. Not only did Jesus reject the Law of Moses as necessary for spiritual enlightenment and salvation, but Jesus never wanted to start Christianity in the first place. He didn’t. He only wanted to teach The Way. That became a religion upon the invention of Christianity. It all went downhill from there.
Jesus’ fulfillment of The Law is based upon his ability to put it into context, which threatened the Jewish leaders hold on religious authority. But by explaining The Law in its relationship to the Ten Commandments, and noting the isolated principles of their purposes, and how they related to governance of a nation vs spiritual salvation, he did in fact fulfill The Law through careful examination and specific teachings about it.
This gave him the authority to write a new commandment which encompassed the true essence of all of Gods Commandments and Jewish Law fulfilled. That being, to love one another.