a=. 'koge=ne#ma=tu'  NB. create the vector
      a='=' NB. find = in the vector
0 0 0 0 1 0 0 0 0 0 1 0 0
      I.a='='  NB. find the indexes
4 10
      [b=.>:I.-.'='i.a   NB. add one to get the next after =
5 11
      b{a  NB. get the text after =
nt

   find=:  verb define
a=. y NB. create the vector
b=.>:I.-.'='i.a   NB. add one to get the next after =
b{a  NB. get the text after =
)

    find  'koge=ne#ma=tu'
nt


2009/1/17 Kairit Sirts <[email protected]>

> Hi!
>
> I'm trying to find those segments from the text, which come immediately
> after '=' 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
>



-- 
Björn Helgason, Verkfræðingur
Fugl&Fiskur ehf,
Þerneyjarsundi 23, Hraunborgum
Po Box 127,801 Selfoss ,
t-póst: [email protected]
gsm: +3546985532
Landslags og skrúðgarðagerð, gröfuþjónusta
http://groups.google.com/group/J-Programming


Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans

góður kennari getur stigið á tær án þess að glansinn fari af skónum
         /|_      .-----------------------------------.
        ,'  .\  /  | Með léttri lund verður        |
    ,--'    _,'   | Dagurinn í dag                     |
   /       /       | Enn betri en gærdagurinn  |
  (   -.  |        `-----------------------------------'
  |     ) |         (\_ _/)
 (`-.  '--.)       (='.'=)
  `. )----'        (")_(") ☃☠
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to