Talk:String Handling Routines

From Kolmafia
Revision as of 08:04, 6 October 2007 by 74.231.24.2 (talk)
Jump to navigation Jump to search

hockey tavolo ik workcentre c2424 porque te vas jeanette diana spencer starsplash when messaggi quasi segreti picchiaduro ps2 videogiochi joe contro il vulcano wgt624 108 marce natalizi netgear wpn824is scarica suonerie panasonic gd87 diclofenac san 100mg 10 sup bernhard herrmann zofilia virgilio djam s veronica pivetti donna cerca singolo cotral finepix s3500 fujifilm scheda memoria optio 750 z gonzaga (mantova) pia crah bandicoot villaggio sardegna aparasphenodon jeep wrangler 2 5 spot nike 2004 petali di stelle costantino e daniele dabadabada ripper convertitore mp3 la sera fiesolana monitor lcd acer al1714 kiss dp558 canon e16 kingston memoria 1024 mb echo park optio z 750 continental gt cerca mar ligurie www club ambola it i piedi nudi vip mulheres choram mais caramella zaino pic nic in da club di tego calderon soave zeffiretto alpine mantova voli san francisco jupy yattaman vol 15 jan amos comenius partitura pachelbel jago un posto al sole rai it techno balilla il moro di venezia golf iv 150 cv ministero difesa it i segreti della magia nera bianca e maq d 145 el fary www zanon it foto di mostri umani carlo de benedetti dhoom tata young giungla di fuoco giovane singola www screen sever com materiale termoidraulico adattatore joystick concerti agosto file mp3 scaricare creme x cazzi samara (provincia) giorgia palmas ogni pistola ha la sua voce desktop celeron mp3 dance wwe lotta i baroni capus alfred webcam livigno sederi vip recorder dvd sony primavera vivaldi lettore mp3 key movie gratis criminali nella notte gruppo continuita ciabatta offerte lavorative in liguria caludia koll nuda sony hifi giochi muti quantz johann joachim renzi center group bologna capodanno scoppio 1 8 fiera inquieta pasion de gavilanes adn kronos fiat ulysse diesel concessionario seat milano la nave maledetta giovanni guareschi foto da votare pim pom jean michel jarre corso formazione post laurea karakum steam cracking passat km0 citroen toscana sborrate sulla figa polo 1 3 polvani giovanni collare cuoio ericsson r380 notebook online hub trust chabrol betty microcomputer fotos putas www malpesa es settore giovanile e scolastico discoteche reggio emilia canon efs 1785 wim meters prostitutas peruanas teloni roosvelt guarnizioni omega kit auto bluetooth quello che capita 883 tennis ace impresi s r l zen lettore palmari asus vendita videcamera minidv man (dipartimento) foto pamela andersson o mark ackermann rudolph software paga soledad a donde baya palmare htc sole aria terra mare o zone fotos fiat 124 anno 2670 ultimo atto cooperativa estense siti della decapitazione sahalin vacanza giappone cd beethoven 9 sinfonia free internet interpretazioni sogni il nostro concerto umberto bindi i ragazzi della buon costume schizzata istituti tecnici luciano tajoli mishima mouse microsoft ottico voli roma atene win mx klubing usrobotics p4 dual core petardas com vides annuncio casa affitto milano gessica alba la donnagatto in dvd on my way allison foggia the text express maglia versus bilancia laica pesa persone piano regolatore cimiteriale ricetta torte rustiche sieben pump it pu ipod photo 60 costa rica ristorante siemens p320 lords psp 1 50 jap multifunzione canon con fax acer pentium 4 centrino 15 4 test di fairley oggi un dio non ho barche piccole claudia khol il dioco delle differenze saitek 52 joystick sexigirl 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.