I want to alter the code below from fiw.ijs so that
I can find the name of a verb, adverb, or conjunction only
if it is NOT being assigned (defined). In other words, in
the cases below in the verb fwssinit , I want names that
match case 1 but do NOT match cases 2, 3, or 4, whereas at
present case 1 does match cases 2, 3, or 4, also. My purpose
is to clean up old code in which I have left in definitions
that are not really used, so I would like to automate the
Find utility by altering it to try to find each name found
in "nl 2 3 4"  against this limited "In context:".

        I am posting in the "general" forum thinking this is
primarily a regex question, but there is clearly a
"programming" aspect.

fwssinit=: 3 : 0

p=. y
nna=. '(^|[^[:alnum:]_])'
nnz=. '($|[^[:alnum:]_])'

select. FIWCONNDX
case. 1 do. p=. nna,p,nnz
case. 2 do. p=. nna,p,'[[:space:]]*=[.:]'
case. 3 do. p=. nna,p,'[[:space:]]*=:'
case. 4 do. p=. nna,p,'[[:space:]]*=\.'
end.

FIWCOMP=: rxcomp_jregex_ :: _1: p

if. FIWCOMP -: _1 do.
  finfo 'Unable to compile regular expression'
  0
else.
  1
end.
)


(B=)

Brian Schott
Atlanta, GA, USA
schott DOT bee are eye eh en AT gee em ae eye el DOT com
http://schott.selfip.net/~brian/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to