Hello there,
i am trying to parse a string expression. The expression looks like this
str = {cc, 1}+{cc, 2}
delimeters = '{', ',', '}'
ant i want to get the result:
cc
1
+
cc
2
Initially i used string.split(str, delimeters) but it returns spaces as
words. I tried Regex but unfortunately i didn't get it to work (or in other
words confused with \#[]#?* etc :)
Any help?
Thanks in advance...
Christos
larrylard@hotmail.com - 28 Jul 2005 15:24 GMT
> Hello there,
> i am trying to parse a string expression. The expression looks like this
[quoted text clipped - 13 lines]
> words. I tried Regex but unfortunately i didn't get it to work (or in other
> words confused with \#[]#?* etc :)
Remove all spaces before using Split? (eventually *someone* will pass
something where space is used as a delimiter, but what can you do?)

Signature
Larry Lard
Replies to group please
Oliver Sturm - 28 Jul 2005 16:26 GMT
> Initially i used string.split(str, delimeters) but it returns spaces as
> words. I tried Regex but unfortunately i didn't get it to work (or in other
> words confused with \#[]#?* etc :)
Splitting with this regular expression should work fine for a start:
,|\{|\}
As Larry mentions, you might want to get rid of the spaces beforehand,
as well as the line prefix ("str ="). You could use a regex for this :-)
A regex replace of " |str\s*=" (without the quotes) with "" (nothing)
should do it.
Oliver Sturm

Signature
omnibus ex nihilo ducendis sufficit unum
Spaces inserted to prevent google email destruction:
MSN oliver @ sturmnet.org Jabber sturm @ amessage.de
ICQ 27142619 http://www.sturmnet.org/blog