Can a person be forgiven outside of confession? (Catholic) As a follow up to this question I'd like to ask if a person, whether Catholic or non-Catholic, can obtain God's forgiveness outside of the sacrament of confession.

I would imagine Protestants would say yes, but what is the Roman Catholic teaching? If the answer is yes, how can one be sure he was forgiven without a priest's absolution?

I know a Catholic would still be required go to confession, but I know Catholics who don't understand this theology but have sincere hearts, and they desire forgiveness outside of the sacrament.
Yes, if one has perfect contrition, which Fr. John Hardon, S.J., defines in his Catholic Dictionary as:

PERFECT CONTRITION
Sorrow for sin arising from perfect love. In perfect contrition the sinner detests sin more than any other evil, because it offends God, who is supremely good and deserving of all human love. Its motive is founded on God's own personal goodness and not merely his goodness to the sinner or to humanity. This motive, not the intensity of the act and less still the feelings experienced, is what essentially constitutes perfect sorrow. A perfect love of God, which motivates perfect contrition, does not necessarily exclude attachment to venial sin. Venial sin conflicts with a high degree of perfect love of God, but not with the substance of that love. Moreover, in the act of perfect contrition other motives can coexist with the perfect love required. There can be fear or gratitude, or even lesser motives such as self-respect and self-interest, along with the dominant reason for sorrow, which is love for God. Perfect contrition removes the guilt and eternal punishment due to grave sin, even before sacramental absolution. However, a Catholic is obliged to confess his or her grave sins at the earliest opportunity and may not, in normal circumstances, receive Communion before he or she has been absolved by a priest in the sacrament of penance.

cf. imperfect contrition (also called &quot;attrition&quot;):

IMPERFECT CONTRITION
Sorrow for sin animated by a supernatural motive that is less than a perfect love of God. Some of the motives for imperfect contrition are the fear of the pains of hell, of losing heaven, of being punished by God in this life for one's sins, of being judged by God; the sense of disobedience to God or of ingratitude toward him; the realization of lost merit or of sanctifying grace. Also called attrition, imperfect contrition is sufficient for remission of sin in the sacrament of penance. It is also adequate for a valid and fruitful reception of baptism by one who has reached the age of reason. And if a person is unable to go to confession, imperfect contrition remits even grave sin through the sacrament of anointing of the sick.

Protestants believe they always have perfect contrition, when the reality is most penitents do not (although they easily could, with God's grace), hence the necessity of Sacramental Confession to a priest.
See also the Council of Trent Session 14 on Penance and Extreme Unction, esp. ch. 4 &quot;On Contrition&quot; and the following canons condemning Protestant heresies regarding confession.
Perfect Contrition Implies Desire for Sacramental Confession to a Priest
Also, the Council of Trent session 14 chapter 4 on contrition notes that perfect contrition is incompatible with a lack of desire for sacramental (auricular) confession to a priest:

The Synod teaches moreover, that, although it sometimes happens that this contrition is perfect through charity, and reconciles man with God before this sacrament be actually received, the said reconciliation, nevertheless, is not to be ascribed to that [perfect] contrition, independently of the desire of the sacrament which is included therein.