Well you can still look for that particular subString - the loop will fail if it's not found. So as long as you are supplying the object's text value as the string, and defining the subString you're looking for, the code still works to validate and post the new subString w/today's date. Just change 2 lines:
var aString = "This is a test on 01/01/2023"; //get text from obj
var aSubString = aqString.SubString(aString, 0, 18); //This_is_a_test_on_
to
var aString = page.FindElement("<xpath to your obj>").contentText; //get text from obj
var aSubString = "This is a test on"; // hard code what you're looking for