I frequently rely on two documentation mechanisms when I want to use
regular expressions in J:

(*) open 'regex'  -- this lets me read the comments while looking at
the definitions. The exported names begin with rx, and rxmatches is
one of the mechanisms I reach for most often. J's open verb might only
work in jqt?

(*) pcre documentation. J's regexp implementation uses the pcre
implementation of regular expressions. Google helps here. (Other
search providers like Bing might also help, but their management often
knows better than me what it is that I am interested in, which I find
confusing.)

Beyond that, experimentation helps, quite a lot (including looking at
shapes and partial results when things get big).

FYI,


--
Raul

On Sun, Mar 6, 2022 at 12:13 PM 'Michael Day' via Programming
<programm...@jsoftware.com> wrote:
>
> I forgot about regular expressions in J, but not familiar with them anyway!
> Used to know them in unix, once upon a time.
> Yr commas much better,  too.
>
> M
>
> On 06/03/2022 17:02, Raul Miller wrote:
> > Here's a version of getoeisseries which only returns direct hits and
> > not cross references:
> >
> > NB. install 'web/gethttp'
> > require'regex web/gethttp'
> >
> > OEIS =: 'http://oeis.org/search?q='  NB. fails with https://... !
> >
> > getoeisseries=: {{
> >    a0=. I.'<a 'E.RAW=:gethttp OEIS,commas y
> >    a1=. I.'</a>'E.RAW
> >    A=. ,{."1'href="/A\d{6}"'rxmatches RAW
> >    a=. RAW{L:0~(a0(+i.)&.>a1-a0){~<:a0 I.A
> >    keep=. -.(1: e. ' title=' E. ])S:0 a
> >    >(}.~1+i.&'>')&.> keep#a
> > }}
> >
> > commas=: rplc&' ,_-'@":
> >
> > FYI,
> >
>
>
> --
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to