I'm trying to modify a binary string. Problem is that the base of the 1s in the string is variable. So it could be that I have 11 that should become 1, but also 111 to become 1 depending on a timeUnit. The timeUnit is longest consecutive '1's divided by 3 (max symbol length = 3 timeUnits).
I tried to replace the 1s with string.gsub!(/1{timeUnit}+/,"1").
In my test if I hard code a number I get the expected string back but I want it to be dynamic.
Is what I am trying to establish possible?
/1{#{timeUnit}}+/?