I found this page
https://msdn.microsoft.com/en-us/library/bs2twtah.aspx

c# regex has an extension called balanced group. But I still
cannot find how to match unbalanced group.

Вс, 25 дек 2016, Raul Miller написал(а):
> For that case, I'd code it in J, first, so that I could be sure it
> works, and then translate that implementation to C#.
> 
> I think regex is a red herring here, because (a) regular expressions
> cannot handle parenthesis balancing by themselves, and (b) the regex
> implementation which J uses does not have sufficient extensions to
> overcome this difficulty. You could do it, with regex plus additional
> wrapper code, but the resulting implementation would probably have
> exponential performance problems in some cases.
> 
> Thanks,
> 
> -- 
> Raul
> 
> 
> On Sun, Dec 25, 2016 at 11:43 AM, bill lam <[email protected]> wrote:
> > In J602 windows front-end, it can high-light the unbalanced
> > parenthesis, the example was taken from config/colorsmp.ijs
> > using the JSample scheme.
> >
> > I think it should be efficient and not coded in J.
> > An implementation in c/c# with regex would be appreciated.
> >
> > Вс, 25 дек 2016, Raul Miller написал(а):
> >> Formally speaking, no, not using pure regular expressions by themselves.
> >>
> >> That said, it is possible to write a program which uses regular
> >> expressions and a stack-like data structure to parse balanced
> >> parenthesis.
> >>
> >> That said, for this problem, something based on +/\-/'()'=/y would
> >> probably be more sensible.
> >>
> >> Do you need an implementation?
> >>
> >> Thanks,
> >>
> >> --
> >> Raul
> >>
> >>
> >> On Sun, Dec 25, 2016 at 11:10 AM, bill lam <[email protected]> wrote:
> >> > Season's Greetings!
> >> >
> >> > Is it possible to use regex to find the first index
> >> > unmatched )(
> >> >
> >> > eg. for the line
> >> > a + ((mno - rst) % b  NB. unmatched paren
> >> >     ^
> >> > 01234
> >> >
> >> >
> >> > --
> >> > regards,
> >> > ====================================================
> >> > GPG key 1024D/4434BAB3 2008-08-24
> >> > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> >> > gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
> >> > ----------------------------------------------------------------------
> >> > For information about J forums see http://www.jsoftware.com/forums.htm
> >> ----------------------------------------------------------------------
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >
> > --
> > regards,
> > ====================================================
> > GPG key 1024D/4434BAB3 2008-08-24
> > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> > gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to