I am trying to find the variables in a string, e.g.
"%0" can not be found. %1 Please try again %2
I need to know how each variable ends (space, period, end of line) cause I will check for the existence of same variable in the translated version of this string. Text comes from a CSV and strings do not end with a line break.
I am able to capture them all except the ones at the end of a string with:
reg = /[%@!][^\s]+[\s\.\z$]+/
I thought either $
or \z
should match end of line but that does not seem to work. How can I capture %2 in the above scenario? (again, there is no line break at the end)