I find no Patrick Ray in the roster of the 8th Alabama, this is most likely your man.
Patrick Reagan/Reigen/Ragan/Regan, Private, Company H, 8th Regiment Alabama Infantry, enlisted March 14, 1862 at Mobile, Ala. by Cleavland for the war, wounded in the battle of Salem Church, Va. May 3, 1863, gunshot, receipted for an issue of clothing at the 2nd Division Gen. Hospital, No. 1, Danville, Va. August 3, 1863, /s/ P Ragan, returned to duty September 1, 1863, captured at the Wilderness May 1, 1864, forwarded to Point Lookout, Md., transferred to Elmire, N. Y. prison August 15, 1864, subscribed to the Oath of Allegiance to the United States and released June 23, 1865, resident of New Orleans, La./Mobile, Ala., florid complexion, dark hair, blue eyes, 5’ 9-1/2”, Clerk, born in Ireland, single
M311: Compiled Service Records of Confederate Soldiers Who Served in Organizations from the State of Alabama