"Now I rejoice, not that you were made sorry, but that your sorrow led to repentance. For you were made sorry in a godly manner, that you might suffer loss from us in nothing. For godly sorrow produces repentance leading to salvation, not to be regretted; but the sorrow of the world produces death" (2 Corinthians 7:9-10).
Being sorry for sin and repenting of sin are two different things. This passage not only distinguishes between sorrow and repentance (which is a change of heart), it also identifies two types of sorrow. Sorrow for sin that is directed toward God produces repentance, while the sorrow of the world produces death. You may be sorry you got caught in your sin. You may be sorry for the effects your sin had on others. But only when you sorrow because you have sinned against God will you be driven to repent - change your heart - leading to salvation.
Judas was remorseful over the outcome of his betrayal of Jesus. He even admitted his sin. But Judas did not have godly sorrow. He killed himself instead of repenting of his sin (Matt. 27:3-5). If you are struggling with sin you need to be sorry "in a godly manner." This type of sorrow toward God will generate the decision of faith to "repent, turn to God and do works befitting repentance" (Acts 26:20).