Forums > MaxMSP

excluding letters from a single string containing numbers


mcQ
April 30, 2013 | 9:44 pm

is it possible to take a message "region1.001" and exclude the "region" part of it so i can process just the number thats part of the message.

it HAS to be one string "region1.001", not "region 1.001"



mcQ
April 30, 2013 | 10:47 pm

actually, how would i take something like "regionx/y" and take out only the x or y values seperately, so if its "region15/65" it say, goes to unpack or whatever, and sends out 15 one outlet and 65 the other outlet.



mcQ
April 30, 2013 | 10:48 pm

i think it has something to do with the [regexp] object, but im struggling to figure it out


April 30, 2013 | 11:01 pm

Here are some solutions:

– Pasted Max Patch, click to expand. –


mcQ
April 30, 2013 | 11:27 pm

thank you very much.
by the way. how do i actually find real in depth explanations of objects like that. it seems that some objects like [regexp] and [sprintf] arent fully explained wherever i try to look.


April 30, 2013 | 11:51 pm

regular expressions (regexp) is a pretty deep topic. You might look here: http://perldoc.perl.org/perlre.html There are whole books on that topic. Similarly, sprintf is a standard C function: http://www.tutorialspoint.com/c_standard_library/c_function_sprintf.htm

There’s no way you’d know either of these things, though. Perhaps the help files should have links.



mcQ
May 1, 2013 | 12:04 am

thanks


May 1, 2013 | 12:50 pm

I like the regular expression documentation that is part of Textwrangler/BBedit user manual. And of course Mastering regular expression’s book which wouldn’t really fit in regexp help file ;-)


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