Forums > MaxMSP

Remove comma separating 2 lists of numbers

April 27, 2011 | 9:22 pm

Hi,

Any regexp experts out there please help me! If i have a message such as "1 2 3 4, 5 6 7 8" and i want to remove the comma so i have "1 2 3 4 5 6 7 8", does anyone know how?

Thanks, Patrick


April 27, 2011 | 10:11 pm

one of my hobbies is avoiding using regexp…;)

– Pasted Max Patch, click to expand. –

April 27, 2011 | 10:34 pm

I like this, however what if my message contained 2 or more commas such as "1 2, 3 4 5, 6 7 8"?

Cheers, Patrick


April 27, 2011 | 11:25 pm

Try thresh, it’s a hack but works like a charm.

– Pasted Max Patch, click to expand. –

April 27, 2011 | 11:33 pm

Amazing! I would never have thought of that, been trying to work my head around regular expressions with little success.

cheers cap, patrick.


April 27, 2011 | 11:38 pm

regexp are the bomb, but it won’t help you in this case. Remember, the commas turn messages into subsequent lists, therefore you have to regroup them together somehow even if you managed to remove the commas; hence thresh.

Otherwise just simply removing a character would be easy.

– Pasted Max Patch, click to expand. –

April 28, 2011 | 2:17 pm

Yeah i was able to remove everything but a comma. I would have thought you would be able to use a \ in front of a comma like you can other metacharacters but obviously not. Thresh is doing nicely.

Patrick


Viewing 7 posts - 1 through 7 (of 7 total)