The Prince of Wales spoke of his son Harry's deployment to Afghanistan as he helped the 1st Queen's Dragoon Guards mark their 50th anniversary.
He told the regiment at Cardiff Castle that he knew "only too well how difficult it can be when your sons and loved ones are absent so long".
The prince said he could only begin to imagine how alarming it must have been serving in Afghanistan.
The regiment recruits soldiers from Wales and the border counties.
The 1st Queen's Dragoon Guards (QDG) lost two troops, Corporal Graham Stiff and Corporal Dean John, during their last tour in Afghanistan.
Prince Charles ''I know only too well how difficult it can be when your sons and loved ones are absent so long"
Dressed in blues, Charles, who is their who is colonel-in-chief, said: "Since I last saw you all you have been through a tough deployment to Afghanistan where enemy activity was relentless, intense and unpredictable.
"I can only begin to imagine how alarming and challenging it must be working in the green zone often only a few metres from a desperate enemy."
The prince said the 50th anniversary celebrations provided him with the opportunity to express his "immeasurable gratitude to the reservists, their long-suffering employers and in particular their families".
"Having gone through the experience with my youngest son who served for a time in Afghanistan, I know only too well how difficult it can be when your sons and loved ones are absent so long," he told them.
"Your sacrifice and your moral support, which are so crucial to the operational success of this fine regiment, are deeply appreciated."
Charles also spoke of his pride in the regiment and told them he hoped parading through the city would lift their spirits.
"As many of you know, my very special grandmother spoke often and fondly of you," he added.
The Welsh Cavalry exercise the freedom of Cardiff by marching along Westgate Street past the Millennium Stadium
"I know she always found her visits immensely enjoyable and you can perhaps imagine I felt enormously privileged to take over from her in July 2003 and establish my association with the Welsh Cavalry."
The history of the QDG stretches back more than 300 years to the formation of the King's Dragoon Guards and the Queen's Bays in 1685. These regiments amalgamated 50 years ago on 1 January 1959 to form QDG.
The regiment is currently based in Paderborn, Germany.
On its recent tour of Afghanistan, which began in October 2008, QDG soldiers operated across Helmand Province.
They were involved in trying to prevent insurgents from reinfiltrating the Garmsir district, which was originally cleared by an American-led operation.
In the past 50 years the regiment has seen active service in Borneo, Aden, Lebanon, the 1991 Gulf War, Bosnia, Kosovo, Northern Ireland, the 2003 Iraq war, two further tours of Iraq and, most recently, the deployment to Afghanistan.
Its role is to scout forward, find the enemy and then relay information back so they can be defeated by the main armoured formations.
QDG was awarded the freedom of Cardiff in 1985 and earlier this month marched through Swansea after being awarded the freedom of the city honour there.
A series of displays showing aspects of regimental life during the past 50 years will be laid out on the castle green on Friday and at 1630 BST the band, accompanied by the Gyrlais Choir, will beat the retreat.
The castle will be closed all day on Friday to the public and will reopen as normal on Saturday at 0900 BST.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.