> I have a lot of trouble understanding regexes, i just don't get how to parse > a file with: > > "Hablar es el arte de sofocar e interrumpir el pensamiento". Thomas Carlyle > (1795-1881); historiador y ensayista escocés. > "Se aprende más por lo que la gente habla entre sí o por lo que se > sobrentiende, que planteándose preguntas". Rudyard Kipling (1865-1936); > escritor inglés, de origen indio. > "Hay palabras que suben como el humo, y otras que caen como la lluvia". > Marquesa de Sévigné,(1626-1696); escritora francesa. > "El destino es el que baraja las cartas, pero nosotros somos los que > jugamos". William Shakespeare (1564-1616); poeta y dramaturgo inglés. > > I need to separate for print the quote, then the name and the coments.
my ($quote, $name, $reign, $comment) = $line =~ /^"([^"]*)"\. # Quote ([^\(]+)\( # Name ([^\)]+)\)\; # Reign ([^\.]+)\.$/x # Comment They can get hairy, and that's probably got an error in it. Basically you need to know: ^ means start of line $ means end of line () means capture and store in a magic variable ($1, $2, ...) [] means a character group (called a 'class') [^] means an inverted character class, which is anything that isn't these characters The /x at the end allows me to put in comments, good luck! Jonathan Paton ===== ---------------BEGIN GEEKCODE BLOCK-----------v3.12 GCS/E d+ s+: a20 C++(+++)>$ UHL++>+++ P+++ L++>++++ E- W++(-) N+ o? K- w--- !O M-- !V PS-- PE++ Y++ PGP t@ 5-- X-- R- tv- b DI+ D- G++ e h! !r--->++ !y--- ----------------END GEEKCODE BLOCK----------------- JAPH: print`perldoc perlembed`=~/(Ju.*)/,"\n" __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]