regexp question

Alejandros Diamandidis adia at egnatia.ee.auth.gr
Thu Nov 27 17:15:19 EET 1997


On Wed, 26 Nov 1997, Christos Ricudis wrote:

> :/\/bin\/false/s/^\([^:]*\):\([^:]*\)/\2:\1/g

neco at hiway.gr (Nikolas Ikonomidis) writes:
> An metafrazame oti elege o ricudis den 8a eimastan foithtes, 8a mas
> eixane proslabei gia metafrastes 3enwn glwsswn :P

Den einai kai toso dyskolo, an to pareis siga-siga...

Leei oti: Sthn epomenh grammh poy periexei to string "/bin/false\s" (opoy to
\s einai whitespace) na antikatastauei to string poy brisketai sthn
arxh ths grammhs kai den periexei to ':' kai akoloytheitai apo ena ':' 
kai sth synexeia ena allo string poy pali den periexei to ':', apo to
deytero string, ena ':', kai meta to prvto string. To 'g' sto telos de 
xreiazetai nomizv, afoy se kathe grammh mono ena string brisketai sthn 
arxh ths... De blaptei pantws. Ayto, px, metatrepei th grammh

/bin/false is koko:zouzouni:rorororororo

sthn 

zouzouni:/bin/false is koko:rorororororo

Twra, o Xristos anarwtiotan giati ayth h entolh den kanei to idio me thn

:s/^\(.*\):\(.*\):\(.*\/bin\/false.*\)/\2:\1:\3/g

Ayth leei: Exoyme sthn arxh ths grammhs poy briskomaste tria string,
me ':' endiamesa, kai to teleytaio periexei to
"/bin/false". Antikatesthse ta me to mesaio string, ':', to prwto, ena 
':', kai telos to teleytaio.

H entolh ayth tha metatrepsei to

koko:kiki:kuku:kaka:keke:ramon/bin/falseti:zouzounwf

se

keke:koko:kiki:kuku:kaka:ramon/bin/falseti:zouzounwf

(epeidh to .* einai "greedy", opws leei se ena keimeno poy eixa
diabasei gia ta regex ths perl, kai trwei oso pio megalo string mporei).
Sto "zouzouni:/bin/false is koko:rorororororo" fysika den doyleyei,
giati to "/bin/false" den brisketai sto trito meros ths grammhs.

Nomizw einai profanes oti oi entoles den kanoyn to idio pragma.

Fysika mporei na kanw kai lathos, den eimai kai poly ejoikiwmenos me
ta regex. An omws einai swsta, opoios endiaferetai na me proslabei gia 
metafrasth as epikoinwnhsei mazi moy =)

-- 
Alejandros Diamandidis * adia at egnatia.ee.auth.gr
--
====================================================================
Gia na mathete pos na xrisimopoiite ton majordomo, stilte e-mail
sto "majordomo at argos.hol.gr" me 1 grammi sto keimeno: help
Ta archives tis listas einai sto http://www.argos.hol.gr/lists
Gia opoiodipote problima stilte  e-mail ston owner-linux-greek-users
====================================================================



More information about the Linux-greek-users mailing list