Forums > MaxMSP

how to remove(strip) a character?

October 17, 2009 | 5:58 am

Dear users,

I want get only one letter from a string.
E.g.:
From Input1 just 1
From Output2 just 2

Does it work in MAX?

best,
prko


October 17, 2009 | 7:22 am

Have a look at [regexp], it’s a bit complicated to understand but if you google "regular expressions" there are some excellent tutorials/manuals on the web.

lh

– Pasted Max Patch, click to expand. –

October 17, 2009 | 11:10 am

thanks!


October 27, 2009 | 6:07 am

This works as well and is easier to understand than regexp…

– Pasted Max Patch, click to expand. –

October 30, 2009 | 8:50 pm

thanks!


October 30, 2009 | 11:25 pm

Hi !
I second thereishopeforus, regexp is a lot more powerful when well used.Here is another example and another solution.

– Pasted Max Patch, click to expand. –

October 30, 2009 | 11:32 pm

Thanks!
I understand now the regexp better!!!!
It is very wonderful explanation.


October 30, 2009 | 11:38 pm

My pleasure, happy to help Smile


November 4, 2009 | 7:44 am

one more question!

how can I get only numbers from the following two stirings?

symbol "1, 2, 3, 4, 5, 6, 7, 8"

and

symbol "1 2 3 4 5 6 7 8"

Regretfully, I have not found the syntax for this case….

best,
prko


November 4, 2009 | 8:27 am

Try [regexp , @substitute " "] for the first example, replacing ,commas, with spaces. The second case just needs a [fromsymbol].

lh


November 4, 2009 | 9:40 pm

Thanks!

My solution is as follows:

– Pasted Max Patch, click to expand. –

November 4, 2009 | 11:58 pm

Be warned that your example will only work for single digit numbers, if your list was "23 -6 3.1415" it wouldn’t work. Try something like [regexp -?\d+\.?\d*] to check for larger numbers, negatives and decimals, if you need to.

lh


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