Regexp, How to exclude characters / Calling Luke Hall :D

G Mrln's icon

Hello,
I have been receiving a stream of data in MAX/MSP that contain int numbers, points (from float numbers), quotation marks, commas and the minus symbol. I have been using regexp to clear a bit my data and I want to take the numbers the points, the minus and exclude the quotation marks and the commas.

I have already searched the regexp reference and help but didnt manage to see how to do that in the regexp object.
Any suggestions?

G Mrln's icon

Actually, I have used regexp \\w+ to take all alphanumeric characters.

Can I somehow include also the minus and the point instead of excluding quotation marks (I noticed that excluding quotation marks is difficult as they are special characters in MAX/MSP)??

G Mrln's icon

Found it --> regexp -?\\w+

Luke Hall's icon

All sorted? What you have would include letters if there were any present in your data stream, if that might happen and you want to make sure you filter them out let me know!

G Mrln's icon

I have managed to sort it out, but now I have a different problem. I get a stream with messages like this: UTF8\;ACCELEROMETER\;X:-0.097443\;Y:0.041306\;Z:-1.000488\;
I want to take out Letters, question marks, slashes, :, but not numbers, points, minus and have a message like this
-0.0.7443 0.041306 -1.000488
I have tried to work a bit on it, but i get spaces in places that I do not want to.

Could you maybe help?

broc's icon

Like this?

Max Patch
Copy patch and select New From Clipboard in Max.