How to validate text using OCRExtractRelative

Hi Team, Can anyone suggest how to add text validations for desktop using OCRExtractRelative?
In my case it is not working as expected. (Most of the times it is failing to get the text & Sometimes it is returning wrong text)

Can you post a video or screenshot of what fails?

It is storing some characters like /r/n at the end of the word captured. How to remove these characters and store again?

I got the Solution in the internet to remove extra spaces from stored text.
| executeScript_Sandbox | return ${material}.replace( /[\r\n]+/gm,“”) | material |