View Single Post
  #104 (permalink)  
Old 09-09-2008, 09:55 AM
Woinowski's Avatar
Woinowski Woinowski is offline
Senior Member
 
Join Date: Aug 2007
Posts: 105
Awards Showcase
Beta Tester 
Total Awards: 1
Default Regular expressions for bracket structures not a really good idea

Quote:
I need help to crete regex for the unsorted lists and sorted lists which can be nested.
Problem with regular expressions is that they mostly are used for a class of languages which are - well - regular. Which means: You cannot really handle bracket structures. If you want to know about the theoretical limitations, have a look at the wikipedia entry (Regular expression - Wikipedia, the free encyclopedia).

Unfortunately, the socalled regular expressions of .NET (and UNIX) are more powerful than the "theoretical" regular expressions. Which leads to expectations that are to high.

But, a tipp: Maxbe you can use a loop in which you replace the lists (from inside out).

Something like:
<while "regular expression for both list types" hits>
Replace inner unsorted list markup
Replace inner sorted list markup
<end while>

The idea is not perfect but might work.

Regards
Jens

PS. The best idea would be to look at open source implementations of other wikis....
__________________
Unclutter your code -- use an obfuscator
Reply With Quote