9 May
2010
9 May
'10
3:49 p.m.
On Sun, May 9, 2010 at 4:57 PM, Kaiting Chen <kaitocracy@gmail.com> wrote:
Just to let you know dude, you can't parse that with a regular expression. A regular expression is modeled / parsed by a finite automaton = a state machine with a finite number of states. Braces allow nesting which creates a source with potentially an infinite number of states consider,
a() { echo 1; b() { echo 2; }; }
Potentially I could next expressions like that endlessly. A regular expression will never be able to parse that.because it can never decide which brace is the final one. This might be better explained here.
http://stackoverflow.com/questions/133601/can-regular-expressions-be-used-to...
thank you. i'll continue my journey on parsing this another way.