From: Ross Bamford Date: 2005-12-22T08:37:49+09:00 Subject: Re: Regex: Up for a challenge? On Wed, 21 Dec 2005 23:03:00 -0000, basi wrote: > Hello, > Just having an outstandingly hard time to even come close to being able > to translate the following string sequences in one or a series of > regular expressions. These are allowable prefix combinations in a > language I'm doing some text analysis on. > > i pa(ki) pag > ma i ka pa(ki) pag > ma pa ka > ma(ki) pag ka > man > m(an) ag ka sin > m(an) ag kan(da) > m(an) ag si(pag) > m(an) ag pa > > The first one allows the following choices: > i, pa, pag, ipa, ipag, ipapag, papag, ipaki, ipakipag, paki, pakipag > > The syllable inside parentheses can only be selected if the syllable or > letter it is attached to is selected. > Maybe these are a bit naive, but they seem to (?) work for the tests I could come up with... 1) /\Ai?(pa(ki)?)?(pag)?\Z/ 2) /\A(ma)?(i)?(ka)?(pa(ki)?)?(pag)?\Z/ 3) /(ma)?(pa)?(ka)?/ 4) /\A(ma(ki)?)?(pag)?(ka)?\Z/ 5) /man/ 6) /\A(m(an)?)?(ag)?(ka)?(sin)?\Z/ 7) /\A(m(an)?)?(ag)?(kan(da)?)?\Z/ 8) /\A(m(an)?)?(ag)?(si(pag)?)?\Z/ 9) /\A(m(an)?)?(ag)?(pa)?\Z/ -- Ross Bamford - rosco@roscopeco.remove.co.uk