I have a message, that counts message reply’s in subject..
the pattern is like this:
RE[22] Some subject
and when person replys to it, it should be:
RE[23] Some subject
So basically I need to get the value between “[” and “]” ( RE[**] ) and change it.. but I can’t just go by length, since it could change, for example, it could be “RE[254]”..
I tried to find solutions with regex or scan but I can’t get this working any way..
I don’t really understand how to do this in ruby.
Ok, i how it works, thanks to Christoph Petschnig and davidrac
In the end, what i did was this:
with cinda did the trick, since my reply number allways would be first, but what if its first message and it dosnt have the RE[] prefix, so i needed to think this furher..
i modified davidrac example a bit and got the solution. So now it dosnt matter if the @string has the RE[] prefix:
or not:
this code will edit or add it: