On Nov 18, 2007, at 4:56 AM, Claude Heiland-Allen wrote:

> Hans-Christoph Steiner wrote:
>> So... anyone want to write a regexp that escapes any unclosed   
>> brackets?  That would be a tricky one... but very useful for Pd.
>
> I guess that it's not possible at all with regular expressions:
>
> http://en.wikipedia.org/wiki/ 
> Regular_language#Regular_languages_over_an_alphabet
> --8<--
> A simple example of a language that is not regular is the set of  
> strings
> { a^n b^n | n >= 0 }.
> --8<--
>
> This is precisely the "matching brackets" problem.

regexps plus something else perhaps.  It's pretty simple to do, just  
count open brackets and close brackets, see if there is a difference,  
then go find the extra and escape it.  Many text editors keep track  
of this stuff on the fly.

.hc


------------------------------------------------------------------------ 
----

I spent 33 years and four months in active military service and  
during that period I spent most of my time as a high class muscle man  
for Big Business, for Wall Street and the bankers.      - General  
Smedley Butler



_______________________________________________
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to