Talk:String Handling Routines

From Kolmafia
Revision as of 16:20, 17 September 2007 by 195.67.48.130 (talk)
Jump to navigation Jump to search

km0 renault clio benzina auto km 0 britannia 25 esibizionismo roma alice in chains music bank the videos hoda televisori da 37 milano bergamo bruxelles biglietti aerei carta de verano televisori lcd sanyo decapitazioni ostaggi in irak mobile per lcd www nic berg it test ammissione psicologia libri barcellona quenn la ragazza di dublino hotel maria foto desktop gratis casio equus tesine di economia idioti testi san salvador moonlight miltiorrhiza magari renato zero medicina ospedali ati amd portatili films gratis amstrad hdd auguri di natale in power point ricoh fax busty redhead io mammeta e tu halo 2 pc voglia di vincere vecchie coppie porche sale cinema medusa supporto mp3 digitale terrestre offerta spedizionieri verona rociera recinzione giardino tecno new age asrock 775dual915gl vaio s4xp friends stagione 7 nic www esselunga it privacy creatina e carnitina tutte le manie di bob gioielli antichi fiat coupe 2 0 16v d12 mu band pullman macerata roma tom tom palm roswell tolleranza the might of ep27 toner nero oregon scientific rm329p tanga rubati frigo ariston classe a foto eddie guerrero gessate giochi di babbo natale hp ipaq rz nicholas burg video lettore mpeg batteria nokia bl5c motorhead athlon64 fx indirizzi delle scuole di estetica un riepilogo in immagini video violenze sessuali in casa enio mercedes sl 2001 hotel trapani howardstern com piscina frosinone clone dvd serial cinema multisala maestoso roma Photos exibitionist fuck Troie napoli Video kelly clarkson because of you Calendario serie a Sesso cavallo porno Queeny love Matura bbw asian Albergo barcellona spagna Ludovico ariosto orlando furioso Porno negre Affitto macchina Imps milano Svevo freud Vagine sfondate Auto usata toyota yaris Leonessa Xxx-password Studi architettura a roma Puttane torino Foto nudo artistico gratis Ragazzi maschi nudi Acquisto orologio Gruppo assicurazione automobile Infermiera troia Piscina vimercate Wwrossoaliceit Little lolita sex Bisiacaria Vesti bratz Porno studentesse Cazzoni in bocca Scarpa basket Chat webcam sesso Ernia Temi e65 Storia e globalizzazione Gruppocarige it Velieri Cartoni animati xxx Mogli cuckold Video melita toniolo Partenone inglese Albergo biarritz Inculata valtellina Scaricare emule Shopping house napoli Regcleaner download Pennello trucco Piquadro Traduttore istantaneo Acido folico Minuteria metallica bologna Corradovideo Hot doctor gets pussy screwed by patient Vespa px Vicky vetta disegni glitterati Icona per il desktop gratis Gratis puttana Anima manga Sanvitolocapo Custodia nera dvd Suore porche Scarpa dimensione danza offerta Santarelli photos Grasse vecchie troie Vedete porno italiane Quindicenni nude Donne anziane sex Tatuaggi lettering Siti gratuiti Cartina sardegna nord Antinfortunistica Castoro Pallet rack Il vangelo di luca Lorena cozza Roberta missoni video porno Www sexyvip tv Albergo salisburgo So wtf does group_string actually do? The linked "descriptive" post has an utterly unhelpful example. Has anyone ever used it for anything?

Groups a string into a map using a regular expression. To understand the function you must know. 1. What maps are and how they are used. 2. Understand what regular expressions are and how to create them.

Using the original post:

FUNCTION DEFINTION: string [int,int] group_string( string source, string regex ) EXAMPLE: string [int,int] test = group_string( "This is a test", "([a-z] ) " );

Example Breakdown: string [int,int] Define a map. Two dimensional. The indices are integers. The data is stored as a string. test Define the map with name test. group_string Call the function. "This is a Test" Feeding the function a sample string. "([a-z] ) " Your regular expression.

Regular expressions deal with pattern matching. You want the function to find a particular pattern. The function then returns that pattern, or the stuff before it, or the stuff after it, or splits them appart, or squeezes them together. So what does this regular expression look for? The Parenthesis (): Tell the function this is a group of characters. [a-z]: Tell us they will be lower case letters.  : Tell us to look for one or more characters. That space between the ) and " Tells us the pattern ends in a space.

Thus reading down the string. T = Does not match [a-z] is a capital letter. h = Matches [a-z]. Starting Group i = Matches [a-z] s = Matches [a-z]

 = Matches space. First group found and is "his "

i = Matches [a-z]. Starting Group s = Matches [a-z]

 = Matches space. Second group found, and is "is "

a = Matches [a-z]. Starting Group

 = Matches space. Third group found, and is "a "

t = Matches [a-z]. Starting Group e = Matches [a-z] s = Matches [a-z] t = Matches [a-z] End of line. No more matches. Stop.

Thus, trusting the post, the map would be:

test[0][0] => "his " test[0][1] => "his" test[1][0] => "is " test[1][1] => "is" test[2][0] => "a " test[2][1] => "a"

I personally haven't used it. Would be used in parsing a page by hand.