Forums > MaxMSP

Replace " with "

Aug 03 2012 | 9:41 pm

Hi all,
I am having a dumb stuper and I can’t figure out how to replace "blah blah blah" with "blah blah blah".
Tried regexp but am struggling here…
Can anyone best my stuper here?

Aug 04 2012 | 10:50 am

You may be stumbling over the fact that the quotation mark is a special character in Max (as in most other programming languages).

It would be helpful to have a specific patch showing what you really want to do. As it is, your first example consists of three symbols:


(including the quotation marks as parts of the first and last symbols) whereas the second is a single symbol

blah blah blah

including the spaces but not including the quotation marks (which simply serve to delimit the beginning and end of the symbol).

Apologies if you’ve already grokked that, but a lot of people stumble over it.

Aug 05 2012 | 11:55 am

Thanks for the reply Peter, however that is not the case.

I have a java object which can only return a message with " instead of ". (I may have to hit up the java forum). But I thought it might be an easy regexp problem to switch them.

Basically the message can be any length with lots of spaces but must be seen as a single symbol, reason why I need to get rid of the backslash and have only double quotes.
And the java output is "x1 x2 x3… xn" and I need "x1 x2 x3 … xn" where x is any symbol and n is any number of symbols.

Thanks for the help,

Aug 05 2012 | 12:11 pm

How about this?

-- Pasted Max Patch, click to expand. --

Aug 05 2012 | 2:11 pm

You ought to be able to handle this in your Java code. Can you show us what you’re doing there?

Aug 13 2012 | 11:44 am

Broc and Peter, Thanks for the help, sorry in the delayed response, I went on vacation for a week and my wife refused to let me take any electronics :)

Broc. In my speedy response last time I failed to properly specify exactly the message… sorry about that.
It’s output is: "x1" "x2" "x3" … "xn". x1 could have "blah blah blah… blah" inside of it.
Thus the regexp solution you posted works to get rid of the outer " but not inner "… Any thoughts?

Peter, I am using java from Mark David to access mysql from (as he has better error messages output than Nick Rothwell’s). BUT his output doesnt contain double quotes, meaning if you have a string like "Blah Blah" it outputs it as Blah Blah, which is a problem because if you query multiple columns (each column can contain spaces) then the column’s data can get mixed up.
For instance, column 1 "The Lead", column 2 "127 435 538". If you query column1 and 2 you get The Lead 127 435 538, I would prefer "The Lead" "127 435 538", so I can parse them inside max to where they need to go. I tried modifying the code (not so skilled with Java) and the best I could do was add " before and after each column making my output, "The Lead" "127 435 538". Any quote tricks I tried didnt work.
So in the attachment is the full Java from Mark David.
Lines 121 and 124 are the output sections needing mod’s, they are:
121: result = result + " " + rs.getString(j);
124: outlet(0, Atom.parse("result"));

How I mod’d it to get "The Lead" "127 437 538"
121: result = result+ " " +"""+rs.getString(j)+""";

Any Ideas with that one on getting "column1" "column2" … "columnN"?

Thanks again for the help guys!

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

Forums > MaxMSP