[Coldstuff] regexp revisited

Adam Cormany coldstuff@cold.org
Mon, 18 Mar 2002 10:55:43 -0800 (PST)


A few months ago I asked for help on a regexp issue I
was having. Brandon attempted to help and had my
problem 90% corrected, but I'm still running into
problems with it. Hopefully this time I can get it
solved for good:)

I want to check a string for "{" or "{a", "{b", "{c"
.. "{z", but I don't want to find "{a}", "{b}", "{c}"
.. "{z}". How can I achieve this on cold with its
regexp? Or is there a better way of doing this?

The reason why I'm doing this is I want to find the
above occurrences and change them from "{a" to "\{a".
I don't want to touch the "{a}" since they are tags. I
want to be able to do this globally through the string
so if a string has something like:
This { is only {a test {b}.
it would translate it to
This \{ is only a \{a test {b}.
I'm doing this all for color.
$compiler.parse_string_new called from
$compiler.compile_cml doesn't like unclosed tags, as
it sees "{a".

Brandon suggested this:
strsed("asdf{a} bcd", "({[^}]+[^}])", "\\%1");
but it's not working correctly.

Any ideas or suggestions?
Thanks for all your help,
Adam

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/