Talk:String Handling Routines

From Kolmafia
Revision as of 11:50, 22 September 2007 by 217.171.176.4 (talk)
Jump to navigation Jump to search

napuli e ank cd vergini r gatos presas trio cordless brondi software e giochi weslo sport 100 tapis roulant foto gratis burro kit asus a620 bt gps locali per scambisti napoli sexefree hotel amrey sant pau barcellona kit vivavoce ericsson the adam s family milano mauritius biglietti aerei operazione drago plastica bujaka jamajka porno vogliose belalim house music cd temario gratis www empiresrts com krystyna escort cam zeta blu xbox live giapponese in prova hp color laserjet 2550n scheda video ati radeon 256 mb agp 8x matia bazar brivido caldo liberty hotel lamma ufficio verona foto rocco sinfredi clairefontaine paperpc sistema operativo xp home ozzano monferrato abit k7 raid richterite formula i cartina storiche mater castrorum giacarta diamond drop saitek rumble pad insufficenza venosa pampar up pirates musk www tnt kamasutra it iona johnny reno per fare l amore incontri reali trento suoneria dune buggy biggest tit musica y matemarica forcella bici niguarda lewisham netgear wg111tis mascia moresco www satlink com figaro d brown angeli e demoni deurne (paesi bassi) gelati per bimbi speculator www dovecomequando it emerson zafira confort elegance daniela romo disney land ciao mare u 96 hard disc lacie 250 aaa color picker 10 olimpus mrobe occhi di gatto vol 1 mediamente isterica di carmen consoli call to power ii trust acquisizione dvd 8x verbatim suzuky gran vitara lampade fluorescenti illuminazione colegialas putas immagini da lost kingdoms ii deposito doblo usato frequenza di eurosport ragazza nizza conspiracy soluzione finale duran duran arena (an absurd notion) e making of arena pantera elettrodomestici smeg a potenza oakley half jacket polarized davvero sexi antenna gps globalsat palio di siena shell shock trucchi organigramma Francesco guccini Notebook acer Foresta Libro dislessia Ww angolo testi it Norimberga cose fare Creare frasi glitterate Curriculum vitae europeo Free mature video Storie porno illustrate Donne vogliose video Asromacalcio it Ghoan sesso con videl Porte vetro scorrevoli Nudo di culi femminili Naruto hentai Puntatori diddl Indata istat it turismo Moissanite Vecchie gratis Hotel portofino Pentola rame Troie che scopano con animali Snai My way frank sinatra Download puntatori mouse Biondine Simpson hentay Culi di donne nere Banco posta on line Albergo sicilia centro Tette mature Incontro webcam sesso Apicoltura piana Spot tv pubblicita musica ford Milva Teen facial kacey Firenze casa Cerco lavoro chiesa valmalenco Pornostar bionde Immagini blog Pornovideo gradis Corsi marketing Discoteca roma cube Sex incontro italia varese Costantino vitagliano Petto di pollo brasato con vino rosso Justine mattera video Annunci69 it Agip petrolio Big teets Finanza online forum snai Hotel don manuel lisbona Poesia anniversario matrimonio Cessione quinto prestito Troia it Boy from istambul Fighe depilate Quotazioni auto storiche Asiatiche nude Misura qi gratis Gay animal sex Canalis porn Pissing porno Refrigerazione frigorifero Andamento euribor Repubblica dominicana Appunti farmacologia Hotel tenerife Borsaitalia it Guepiere Custodia nera dvd Bed and breakfast stresa Jazz piano spartito Foto inculata scopata transex Rinoplastica settoplastica Amburgo cose fare Avatar per extremelot Sexy granny Spaghetti con le cozze Porno free trans Teen tits Hotel pescasseroli Gormiti colorare Offerta hotel rimini Foto di nudi maschili Giovanni allevi Investire borsa Pokemon rosso fuoco Implantologia croazia Il piccolo Decolte Anteprima video pornografici Roroscopo Dormire madrid Tendinite Culi sexy Amsterdam ristorante Vendita dvd r Articolo regalo cristallo 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.