It's possible.... but would take some ugly coding.
Do you have to use \r\n to separate the values? If you used comma separated strings, then this could be done using arrays.
First, all comments would need to be a string like this:
The main script loops through all comments, extracts values, and changes the ones you specify.
/ip hotspot user
:foreach i in=[find] do={
# get comment, convert to array
:local in [:toarray [get $i comment]]
# change selected array item
:set ($in->1) "foo"
# output string container
:local out
# counter to keep track of where we are at in array
:local count 1
# loop through array, reconstruct comma separated string
:foreach j in=$in do={
:set out ($out . $j)
:if ($count < [:len $in]) do={
:set out ($out . ",")
}
:set count ($count + 1)
}
# set comment with new string
set $i comment="$out"
}
The line above you want to change is this one. The number 1 is the array position, and the "foo" is the value you want to change to. Every comment will be changed.