Study the words RUE, RUEFUL, and RUEFULLY:
(Source)
To rue something that you did is to feel bad about it and wish you hadn't done it. You could just say that you regret something, or that you feel sorry about something, but the word "rue" helps you sound very serious.
For example, when I said something unkind to my sister, and then I saw that her feelings were badly hurt, I rued my words. That means I regretted saying what I had, and I wished I could go back in time and NOT say it.
"Rue" is a very serious, very dramatic word. It can sound old-fashioned. In a story, right after the hero defeats the villain, the villain might shout, "I'll make you rue the day you did this!" Which means, "I'll make you regret this! I'm make you feel sorry that you ever did this!"
But you can also use the word "rue" in a more lighthearted way, to exaggerate how bad you felt about something. For example, I rue the day I accidentally put a huge chunk of minced garlic in my dishwasher. It made all of our dishes reek of garlic for weeks! Every time I raised a glass to my mouth and caught another whiff of garlic, I laughed ruefully. "Ughgh, huh... huh, huh, huh."
When someone gives a rueful smile or a rueful laugh, it shows how they feel regret or sorrow. And when you say something ruefully, or when you laugh or smile ruefully, you're revealing how bad you feel, and how you wish you could change the way you acted before.
By the way, "rue" is also the name of a plant. Rue, also known as common rue or garden rue, has delicate yellow flowers and sharp-smelling, bitter-tasting leaves, which, centuries ago, people used to make medicine.
That's good to know when you meet a character named Rue! Here's Rue from The Hunger Games, by Suzanne Collins. She's named for the plant, which is appropriate because she's small and delicate like the flowers, and because she knows how to use leaves to make medicine. Even more appropriately, in the story, Rue symbolizes sorrow and regret. I won't say more, or I'd spoil the story for you! But remember that when you rue something, you might cry bitter tears, wishing you could have done something different.