easy regexp by irori

z '|'=' '
z c=c
s#r=[x++t|x<-s,t<-m r]
(s,_:'?':r)%f=m r++f s#r
(s,_:r)%f=f s#r
m""=[""]
m('[':s)=span(/=']')s%map(:[])
m('(':s)=span(/=')')s%(words.map z)
m(c:s)=([c],c:s)%(:[])
main=getLine>>=mapM putStrLn.m

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page