regexping noobness ....

joumik's icon

Hi everybody ,

i would like to use coll as a text bank .
it will be used to display text on a jit.gl.text3d .

My problem is that i have to be able to include characters like :
, ; ( ) ' " , etc ...
dots and semicolons obviously create errors , but maybe some other characters would , to .

adding a backslash \ before coma or semi-colon allows me to keep it in the output text .
So , great !
But i have to deal with entire books , and i can't spend that time , manually adding backslashes ,
i did it once on a theatre play , it was really painful .

i 've spent some hours , trying to understand all i can , concerning regexp object ,
but i don' t manage to substitute coma with a backslash coma , same for semicolon , ... (i'd like to do it for all the characters that will interfere with coll's behaviour ) .

Would anyone help me with this ?
adding a backslash just before some meta-characters ?
(Maybe i'm wrong , using the word "meta-characters" , but i think this is how they have to be called )

Cheers everybody ,

Matthieu

Brecht's icon

I would also be interested to see a solution for this. I remember some other issue being posted here concerning the 'text' object and comma's, semi-colons and escape characters which was never solved (except for the 'learn java' solution).

It would be nice to have some conclusive answer by someone more knowledgable in order to know whether it is at all possible.

metamax's icon

Maybe this helps?

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

joumik's icon

hi Metamax , thanks a lot .

it seems to partly do the job , yes !
but not completely .

As soon as i enter a sentence , the comas break the list , and the initial list is truncated , pieces being output one after the others .

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

here's a quick example of what i'd like (thanks for your sprintf trick !

Matthieu

metamax's icon

Oh I see. Yeah, those commas are slippery to escape and will be a constant nuisance. [coll] is designed to manage data as an array of associated elements - not as strings of text. Also remember that message boxes aren't really for text. They are for messages.. which may be adding to your problems. Have you considered using [text]?

joumik's icon

you' re right ,
also use of semi-colon in message boxes forces breaking lines , ...

so , it seems i must have a look on [text] .

thanks for this light .

Matthieu

Brecht's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I don't know how hooked you are on the coll, but you could also do it like this: (don't forget to download the attached .txt file)

TextTest.txt
txt
mizu's icon
Max Patch
Copy patch and select New From Clipboard in Max.

2cents...

joumik's icon

hey , brecht and mizu ,
thanks for cents .

both jit.textfile and the "append method" are interesting .

Thanks everybody , i'll see which method i'll adapt to the project .

thanks again

Matthieu

joumik's icon

Hi ,
i finally spent some time , trying tu use jit.text .

which , definitely ,
seems to be the real one i need,
as it can output all meta-characters , without considering them differently from simple characters .

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

But i still have a problem .
here's the simplest patch possible .

(attached is also a textfile to load in the jit.textfile)

You can also type any text you want in it .

As i recall the lines , in any particular order ,
the jit.gl.text3d objects randomnly displays truncated , slightly different ,from the original ones written in the jit.textfile ,
strings of text .

sometimes the first character is truncated , sometimes the last ,
sometimes japanese (or other) characters are added at the end , ...
all this happening very randomnly .

Can you reproduce this on your computers ?
to check , you can load the textfile , and then , playing with the integer box ,
output all the lines , ones after the others .
The problem happens sometimes immediatly , sometimes after 5 , or 10 , or 15 , line recalls .

I hope i'm missing something obvious ,
because this object would be so perfect for my needs ....

Thanks for your help ,

Matthieu

testfile.txt
txt
joumik's icon

problem solved !

see rob's post about it .

so ,
now ,
jit.textfile is the one !

thanks
matthieu