I just sorted out a bug in my live coding system. It uses a method that collects methods of certain classes and formats them into a regExp string for the preProcessor. It’s a bit clumsy, but kind of works. However, it seems that collect no longer returns arrays with spaces at the beginning and end? I have nothing against this change, but it turned out to be a breaking change in this case, because "[ " is obviously not the same regexp as "[". I just though that it might be useful to highlight this in case someone else stumbles upon it.
So, this: Array.methods.collect{|m| m.name};
now returns: -> [reverse, scramble, mirror, mirror1, mirror2, stutter, dupEach, rotate...]
instead of the previous: -> [ reverse, scramble, mirror, mirror1, mirror2, stutter, dupEach, rotate... ]
If I’ve understood your intent correctly — that you now need to match [, [ , ], and ] — you might consider using one of the following regular expressions as examples.
\[\s*
matches a [ followed by zero or more whitespace characters
\[ *
matches a [ followed by zero or more spaces
\[ ?
matches a [ followed by zero or one space
\[\s?
matches a [ followed by zero or one whitespace character
\[( |)
matches a [ followed by either a space or nothing
The string representation of arrays changed – so the issue is not collect (which will return the same list of symbols) – it’s the asString that is providing the regexp-able content.