On Wed, 20 Jun 2012 19:14:55 +0200 Lionel Cons wrote:
> On 20 June 2012 06:43, олÑга кÑÑжановÑкаÑ
> <[email protected]> wrote:
> > Glenn, this looks right:
> > xmltext='<h1><div> a text </div><!-- a comment (<disabled>) --></h1>'
> >
> > dummy="${xmltext//~(Ex)(?:
> > Â Â Â (<!--.+-->)+?| Â # xml comments
> > Â Â Â (<.+>)+?| Â # xml tags
> > Â Â Â ([^[><]]+)+? Â Â # xml text
> > Â Â Â )/dummy}"
> > print -v .sh.match
> >> ----- cutme ----
> <RANT>
> I'm likely going to be sorry for this email, but:
> For crying out loud.
> For gods sake.
> What is this?
> 1. What you do with these regex is useful. Very very useful.
> 2. What you archive is magic for those not being initiated in the
> rituals of regex
> 3. ksh93 and libast seem to have a very, very powerful regex engine
> But:
> Where... is... this... documented?
> For a *long* time I would really appreciate that the --man pages for
> grep, sed and ksh include a complete list of regex commands, including
> examples. Also example code would be very, very nice. Neither ast-open
> nor ast-ksh has *any* godforsaken example code. It does *not* help if
> you have one of the best regex engines in this world when only those
> initiated in the ways of ast regex can use it.
> </RANT>
> Sorry, bad day today. Started bad, will end in disaster.
some rants make me smile in a good way
you are completely correct about the documentation for library code I'm
responsible for
given the choice between documenting and hacking, guess which way I go
at least anything involving ast::optget() forces me document before proceeding
(getting me to document was one of the driving forces behind optget())
after we stabilize the current release regex is at the top of my documentation
list
the particular example from Roland and Olga that triggered the rant uses
perl constructs, in particular non-greedy matching
I implemented it and understand how the algorithm works in comparison
to the default greedy algorithm
but that doesn't mean I'm fluent in its usage
this is true for a lot of ast features
input from the user community can have a positive impact on the example corpus
if you dig in the source you can find some very interesting shell, C and RE
examples
lurking in the regression tests
re example code
in any src/** dir that contains a Makefile or Nmakefile look at *.@(rt|tst)
in src/cmd/tests look at *.dat which are input files for the testregex test
harness
testregex is not installed -- find that in $INSTALLROOT/src/cmd/tests
to generate that
bin/package use
cd re
nmake test
testregex --man
testregex is also documented in the manual nav at
www.research.att.com/sw/download/
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users