Presumably you mean the alphabetic text between
an = and the next non-alphabetic character.
For this kind of thing functions other than ;: are
more straightforward. Thus:
alp=: a.{~,65 97+/i.26
f=: (('='={.&>) # }.&.>) @ (-.@(e.&alp) <;.1 ])
f 'koge=ne#ma=tu'
+--+--+
|ne|tu|
+--+--+
----- Original Message -----
From: Kairit Sirts <[email protected]>
Date: Saturday, January 17, 2009 9:02
Subject: [Jprogramming] Processing text with dyad ;:
To: 'Programming forum' <[email protected]>
> Hi!
>
> I'm trying to find those segments from the text, which come
> immediatelyafter '=' and end with any other non-character. In a
> string 'koge=ne#ma=tu'
> I'd like to find 'ne' and 'tu'.
>
> I use the fsm for it and by using the function code 5 it seems that
> everyting works fine. But using the function code 0 it does not
> work so
> well.
>
> mj =. 256$0
> mj=. 1 ((,(a.i.'Aa')+/i.26),132,149, 150, 156, 161,
> 164, 181, 182, 188,
> 190, 195, 197)} mj
> mj =. 2 (a.i.'=')} mj
>
> st =. 3 3 2 $ 0 0 0 0 1 0 0 0 2 1 0 0 0 5 2 0 1 5
> x =. 5;st;mj; 0 _1 0 0
>
> x ;: 'koge=ne#ma=tu'
> 0 _1 0 1 0 0
> 1 _1 0 1 0 0
> 2 _1 0 1 0 0
> 3 _1 0 1 0 0
> 4 _1 0 2 1 0
> 5 _1 1 1 2 1
> 6 5 2 1 2 0
> 7 5 2 0 0 5
> 8 _1 0 1 0 0
> 9 _1 0 1 0 0
> 10 _1 0 2 1 0
> 11 _1 1 1 2 1
> 12 11 2 1 2 0
> 13 11 2 0 0 5
>
> x =. 0;st;mj; 0 _1 0 0
> x ;: 'koge=ne#ma=tu'
>
>
> With f code 5 I see that two items should be output, but with f
> code 0
> nothing will be output. Where is the mistake I do not see?
>
> Kairit Sirts
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm