Regularni vyraz

Martin 'Goran' Moravec goran na ucw.cz
Úterý Leden 15 09:48:12 CET 2002


> Prosim o pomoc s vytvorenim regularniho vyrazu, ktery vybere cokoliv uzavreneho do apostrofu. Jenze to "cokoliv" muze obsahovat i \" (backslash nasledovane uvozovkami). Napr.:
> 
> textik pred "a toto se vybere \"a jeste pokracujeme\" az sem" a textik za
> 
> vybere vse od a toto.. k ..az sem.
> 

aha, takze ne apostrofy, ale uvozovky

no, zalezi na implementaci

v perlu 

perl -pe 's/\"(\\.|[^"\\])*\"/ahoj/g; print ' 

v sedu

sed -e 's/\"\(\\.\|[^"\\]\)*\"/ahoj/g ' 



-- 
--
    A novice was trying to fix a broken lisp machine by turning the
power off and on.  Knight, seeing what the student was doing spoke sternly,
"You cannot fix a machine by just power-cycling it with no understanding
of what is going wrong."  Knight turned the machine off and on.  The
machine worked.			
--					Just another form of life
						Goran


Další informace o konferenci Linux