I would like to remove all empty spaces at the end of the text. trim function is not working in survey123. Is there any way to remove the empty spaces from the end of text in survey123?
It's no trim, but you could try adding a constraint to prevent survey responses from being submitted with trailing whitespace: not(regex(., '\s$'))
The $ within the expression specifically looks for matches at the end of the string. The \s matches any whitespace, including spaces, tabs, and carriage returns (in case you're using this in a multiline text field).