Talk:String Handling Routines: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
So wtf does group_string actually do?  The linked "descriptive" post has an utterly unhelpful example.  Has anyone ever used it for anything?
[http://kruppkw.50webs.com/new/hockey-tavolo/ hockey tavolo] [http://gekijuls.50webs.com/resources/ik.htm ik] [http://tigerlilly2063.50webs.com/workcentre-c/ workcentre c2424] [http://kaygigi.50webs.com/articles/porque-te/ porque te vas jeanette] [http://pulema.50webs.com/resources/diana-spencer1/ diana spencer] [http://ir4ik.50webs.com/view/starsplash-when.htm starsplash when] [http://devthemagister.50webs.com/web/messaggi-quasi.htm messaggi quasi segreti] [http://tigerlilly2063.50webs.com/picchiaduro-ps/ picchiaduro ps2 videogiochi] [http://tigerlilly2063.50webs.com/joe-contro/ joe contro il vulcano] [http://brittpach7.50webs.com/text/wgt.htm wgt624 108] [http://pulema.50webs.com/resources/marce-natalizi/ marce natalizi] [http://gekijuls.50webs.com/resources/netgear-wpnis.htm netgear wpn824is] [http://terrastaoid.50webs.com/resources/scarica-suonerie3/ scarica suonerie panasonic gd87] [http://iguanalady.50webs.com/diclofenac-san.htm diclofenac san 100mg 10 sup] [http://kruppkw.50webs.com/new/bernhard-herrmann/ bernhard herrmann] [http://sneezingpops.50webs.com/blog/zofilia/ zofilia] [http://pulema.50webs.com/resources/virgilio/ virgilio] [http://iguanalady.50webs.com/djam-s.htm djam s] [http://terrastaoid.50webs.com/resources/veronica-pivetti/ veronica pivetti] [http://levplatonov.50webs.com/content/donna-cerca1/ donna cerca singolo] [http://brittpach7.50webs.com/text/cotral.htm cotral] [http://iguanalady.50webs.com/finepix-s.htm finepix s3500 fujifilm] [http://bookishfellow.50webs.com/new/scheda-memoria1.htm scheda memoria] [http://dragonchan.50webs.com/description/optio-/ optio 750 z] [http://cheburashka21.50webs.com/html/gonzaga-mantova/ gonzaga (mantova)] [http://sneezingpops.50webs.com/blog/pia/ pia] [http://starbestfik.50webs.com/topic/crah-bandicoot/ crah bandicoot] [http://sneezingpops.50webs.com/blog/villaggio-sardegna/ villaggio sardegna] [http://sneezingpops.50webs.com/blog/aparasphenodon/ aparasphenodon] [http://bookishfellow.50webs.com/new/jeep-wrangler2.htm jeep wrangler 2 5] [http://tigerlilly2063.50webs.com/spot-nike/ spot nike 2004] [http://ir4ik.50webs.com/view/petali-di.htm petali di stelle] [http://exlerrss.50webs.com/text/costantino-e.htm costantino e daniele] [http://dragonchan.50webs.com/description/dabadabada/ dabadabada] [http://devthemagister.50webs.com/web/ripper-convertitore.htm ripper convertitore mp3] [http://dragonchan.50webs.com/description/la-sera/ la sera fiesolana] [http://gekijuls.50webs.com/resources/monitor-lcd23.htm monitor lcd acer al1714] [http://pulema.50webs.com/resources/kiss-1/ kiss  dp558] [http://levplatonov.50webs.com/content/canon-e/ canon e16] [http://kruppkw.50webs.com/new/kingston-1/ kingston  memoria  1024 mb] [http://ir4ik.50webs.com/view/echo-park.htm echo park] [http://devthemagister.50webs.com/web/optio-z.htm optio z 750] [http://kaygigi.50webs.com/articles/continental-gt/ continental gt] [http://starbestfik.50webs.com/topic/cerca-mar/ cerca mar ligurie] [http://dragonchan.50webs.com/description/www-club1/ www club ambola it] [http://terrastaoid.50webs.com/resources/i-piedi/ i piedi nudi vip] [http://cheburashka21.50webs.com/html/mulheres-choram/ mulheres choram mais] [http://pulema.50webs.com/resources/caramella/ caramella] [http://starbestfik.50webs.com/topic/zaino-pic/ zaino pic nic] [http://brittpach7.50webs.com/text/in-da.htm in da club di tego calderon] [http://dragonchan.50webs.com/description/soave-zeffiretto/ soave zeffiretto] [http://dragonchan.50webs.com/description/alpine-mantova/ alpine mantova] [http://pulema.50webs.com/resources/voli-san/ voli san francisco] [http://tigerlilly2063.50webs.com/jupy/ jupy] [http://kruppkw.50webs.com/new/yattaman-vol2/ yattaman vol 15] [http://levplatonov.50webs.com/content/jan-amos/ jan amos comenius] [http://anetaspb.50webs.com/content/partitura-pachelbel.htm partitura pachelbel] [http://terrastaoid.50webs.com/resources/jago/ jago] [http://pulema.50webs.com/resources/un-posto1/ un posto al sole rai it] [http://levplatonov.50webs.com/content/techno-balilla/ techno balilla] [http://tigerlilly2063.50webs.com/il-moro/ il moro di venezia] [http://starbestfik.50webs.com/topic/golf-iv5/ golf iv 150 cv] [http://starbestfik.50webs.com/topic/ministero-difesa/ ministero difesa it] [http://howquickly.50webs.com/articles/i-segreti4.htm i segreti della magia nera bianca e] [http://howquickly.50webs.com/articles/maq.htm maq] [http://kruppkw.50webs.com/new/d4/ d 145] [http://devthemagister.50webs.com/web/el-fary.htm el fary] [http://sneezingpops.50webs.com/blog/www-zanon/ www zanon it] [http://levplatonov.50webs.com/content/foto-di54/ foto di mostri umani] [http://devthemagister.50webs.com/web/carlo-de.htm carlo de benedetti] [http://bookishfellow.50webs.com/new/dhoom-tata.htm dhoom tata young] [http://ir4ik.50webs.com/view/giungla-di.htm giungla di fuoco] [http://bookishfellow.50webs.com/new/giovane-singola.htm giovane singola] [http://anetaspb.50webs.com/content/www-screen.htm www screen sever com] [http://kruppkw.50webs.com/new/materiale-termoidraulico/ materiale termoidraulico] [http://terrastaoid.50webs.com/resources/adattatore-joystick/ adattatore joystick] [http://tigerlilly2063.50webs.com/concerti-agosto/ concerti agosto] [http://starbestfik.50webs.com/topic/file-mp/ file mp3 scaricare] [http://devthemagister.50webs.com/web/creme-x.htm creme x cazzi] [http://anetaspb.50webs.com/content/samara-provincia.htm samara (provincia)] [http://kruppkw.50webs.com/new/giorgia-palmas3/ giorgia palmas] [http://iguanalady.50webs.com/ogni-pistola.htm ogni pistola ha la sua voce] [http://devthemagister.50webs.com/web/desktop-celeron.htm desktop celeron] [http://ir4ik.50webs.com/view/mp-dance1.htm mp3 dance] [http://howquickly.50webs.com/articles/wwe-lotta.htm wwe lotta] [http://exlerrss.50webs.com/text/i-baroni.htm i baroni] [http://kaygigi.50webs.com/articles/capus-alfred/ capus alfred] [http://devthemagister.50webs.com/web/webcam-livigno.htm webcam livigno] [http://ryolove.50webs.com/resources/sederi-vip.htm sederi vip] [http://kaygigi.50webs.com/articles/recorder-dvd4/ recorder dvd sony] [http://gekijuls.50webs.com/resources/primavera-vivaldi.htm primavera vivaldi] [http://exlerrss.50webs.com/text/lettore-mp46.htm lettore mp3 key] [http://gekijuls.50webs.com/resources/movie-gratis.htm movie gratis] [http://exlerrss.50webs.com/text/criminali-nella.htm criminali nella notte] [http://howquickly.50webs.com/articles/gruppo-continuita3.htm gruppo continuita ciabatta] [http://cheburashka21.50webs.com/html/offerte-lavorative/ offerte lavorative in liguria] [http://kaygigi.50webs.com/articles/caludia-koll/ caludia koll nuda] [http://gekijuls.50webs.com/resources/sony-hifi1.htm sony hifi] [http://exlerrss.50webs.com/text/giochi-muti.htm giochi muti] [http://dragonchan.50webs.com/description/quantz-johann/ quantz johann joachim] [http://crackoaon.freehostia.com/renzi-center/ renzi center group] [http://lesh1a1.freehostia.com/data/bologna-capodanno.htm bologna capodanno] [http://usverag-ekb.freehostia.com/small/scoppio/ scoppio 1 8] [http://geneocide.freehostia.com/lib/fiera-inquieta2.htm fiera inquieta pasion de gavilanes] [http://macahi-neko.freehostia.com/adn-kronos/ adn kronos] [http://lesh1a1.freehostia.com/data/fiat-ulysse4.htm fiat ulysse diesel] [http://ptisaa-jill.freehostia.com/concessionario-seat1/ concessionario seat milano] [http://crackoaon.freehostia.com/la-nave6/ la nave maledetta] [http://juli8a.freehostia.com/new/giovanni-guareschi.htm giovanni guareschi] [http://ms-beaeblebrox.freehostia.com/html/foto-da3.htm foto da votare] [http://deathrays.freehostia.com/new/pim-pom.htm pim pom] [http://chistoasya.freehostia.com/topic/jean-michel2/ jean michel jarre] [http://juli8a.freehostia.com/new/corso-formazione3.htm corso formazione post laurea] [http://chistoasya.freehostia.com/topic/karakum/ karakum] [http://geneocide.freehostia.com/lib/steam-cracking.htm steam cracking] [http://kynaon.freehostia.com/library/passat-km1/ passat km0] [http://assaharp.freehostia.com/html/citroen-toscana.htm citroen toscana] [http://paleshaadow.freehostia.com/text/sborrate-sulla.htm sborrate sulla figa] [http://junkland-raed.freehostia.com/styles/polo8.htm polo 1 3] [http://juli8a.freehostia.com/new/polvani-giovanni.htm polvani giovanni] [http://paleshaadow.freehostia.com/text/collare-cuoio.htm collare cuoio] [http://junkland-raed.freehostia.com/styles/ericsson-r.htm ericsson r380] [http://kynaon.freehostia.com/library/notebook-online/ notebook online] [http://ptisaa-jill.freehostia.com/hub-trust/ hub trust] [http://miraxcaorran.freehostia.com/lib/chabrol-betty.htm chabrol betty] [http://macahi-neko.freehostia.com/microcomputer/ microcomputer] [http://disexat.freehostia.com/articles/fotos-putas/ fotos putas] [http://knave-aof-clubs.freehostia.com/view/www-malpesa/ www malpesa es] [http://kynaon.freehostia.com/library/settore-giovanile/ settore giovanile e scolastico] [http://assaharp.freehostia.com/html/discoteche-reggio.htm discoteche reggio emilia] [http://assaharp.freehostia.com/html/canon-efs8.htm canon efs 1785] [http://lesh1a1.freehostia.com/data/wim-meters.htm wim meters] [http://junkland-raed.freehostia.com/styles/prostitutas-peruanas.htm prostitutas peruanas] [http://knave-aof-clubs.freehostia.com/view/teloni/ teloni] [http://macahi-neko.freehostia.com/roosvelt/ roosvelt] [http://deathrays.freehostia.com/new/guarnizioni-omega.htm guarnizioni omega] [http://kynaon.freehostia.com/library/kit-auto11/ kit auto bluetooth] [http://miraxcaorran.freehostia.com/lib/quello-che4.htm quello che capita 883] [http://juli8a.freehostia.com/new/tennis-ace.htm tennis ace] [http://lesh1a1.freehostia.com/data/impresi-s.htm impresi s r l] [http://juli8a.freehostia.com/new/zen-lettore.htm zen lettore] [http://juli8a.freehostia.com/new/palmari-asus1.htm palmari asus vendita] [http://juli8a.freehostia.com/new/videcamera-minidv.htm videcamera minidv] [http://junkland-raed.freehostia.com/styles/man-dipartimento.htm man (dipartimento)] [http://assaharp.freehostia.com/html/foto-pamela1.htm foto pamela andersson] [http://ms-beaeblebrox.freehostia.com/html/o-mark.htm o mark] [http://lesh1a1.freehostia.com/data/ackermann-rudolph.htm ackermann rudolph] [http://kieloida.freehostia.com/library/software-paga/ software paga] [http://knave-aof-clubs.freehostia.com/view/soledad-a/ soledad a donde baya] [http://geneocide.freehostia.com/lib/palmare-htc.htm palmare htc] [http://juli8a.freehostia.com/new/sole-aria.htm sole aria terra mare] [http://geneocide.freehostia.com/lib/o-zone68.htm o zone fotos] [http://disexat.freehostia.com/articles/fiat11/ fiat 124] [http://disexat.freehostia.com/articles/anno-1/ anno 2670 ultimo atto] [http://zankoaku-zen.freehostia.com/lib/cooperativa-estense.htm cooperativa estense] [http://juli8a.freehostia.com/new/siti-della.htm siti della decapitazione] [http://knave-aof-clubs.freehostia.com/view/sahalin/ sahalin] [http://ms-beaeblebrox.freehostia.com/html/vacanza-giappone.htm vacanza giappone] [http://assaharp.freehostia.com/html/cd-beethoven.htm cd beethoven 9 sinfonia] [http://disexat.freehostia.com/articles/Free-internet1/ free internet] [http://miraxcaorran.freehostia.com/lib/interpretazioni-sogni.htm interpretazioni sogni] [http://disexat.freehostia.com/articles/il-nostro5/ il nostro concerto umberto bindi] [http://zankoaku-zen.freehostia.com/lib/i-ragazzi14.htm i ragazzi della buon costume] [http://macahi-neko.freehostia.com/schizzata/ schizzata] [http://lesh1a1.freehostia.com/data/istituti-tecnici2.htm istituti tecnici] [http://lesh1a1.freehostia.com/data/luciano-tajoli.htm luciano tajoli] [http://ms-beaeblebrox.freehostia.com/html/mishima.htm mishima] [http://deathrays.freehostia.com/new/mouse-microsoft.htm mouse microsoft ottico] [http://mysteaaricafende.freehostia.com/voli-roma3/ voli roma atene] [http://usverag-ekb.freehostia.com/small/win-mx3/ win mx] [http://disexat.freehostia.com/articles/klubing/ klubing] [http://junkland-raed.freehostia.com/styles/usrobotics.htm usrobotics] [http://zankoaku-zen.freehostia.com/lib/p-dual.htm p4 dual core] [http://mysteaaricafende.freehostia.com/petardas-com2/ petardas com vides] [http://mysteaaricafende.freehostia.com/annuncio-casa5/ annuncio casa affitto milano] [http://mysteaaricafende.freehostia.com/gessica-alba/ gessica alba] [http://knave-aof-clubs.freehostia.com/view/la-donnagatto/ la donnagatto in dvd] [http://ptisaa-jill.freehostia.com/on-my7/ on my way] [http://macahi-neko.freehostia.com/allison-foggia/ allison foggia] [http://junkland-raed.freehostia.com/styles/the-text.htm the text express] [http://junkland-raed.freehostia.com/styles/maglia-versus.htm maglia versus] [http://zankoaku-zen.freehostia.com/lib/bilancia-laica.htm bilancia laica pesa persone] [http://assaharp.freehostia.com/html/piano-regolatore.htm piano regolatore cimiteriale] [http://juli8a.freehostia.com/new/ricetta-torte2.htm ricetta torte rustiche] [http://macahi-neko.freehostia.com/sieben/ sieben] [http://geneocide.freehostia.com/lib/pump-it9.htm pump it pu] [http://chistoasya.freehostia.com/topic/ipod-photo3/ ipod photo 60] [http://macahi-neko.freehostia.com/costa-rica3/ costa rica ristorante] [http://knave-aof-clubs.freehostia.com/view/siemens-p1/ siemens p320] [http://chistoasya.freehostia.com/topic/lords/ lords] [http://usverag-ekb.freehostia.com/small/psp-/ psp 1 50 jap] [http://ms-beaeblebrox.freehostia.com/html/multifunzione-canon3.htm multifunzione canon con fax] [http://geneocide.freehostia.com/lib/acer-pentium1.htm acer pentium 4 centrino 15 4] [http://miraxcaorran.freehostia.com/lib/test-di6.htm test di fairley] [http://lesh1a1.freehostia.com/data/oggi-un.htm oggi un dio non ho] [http://ptisaa-jill.freehostia.com/barche-piccole/ barche piccole] [http://chistoasya.freehostia.com/topic/claudia-khol/ claudia khol] [http://paleshaadow.freehostia.com/text/il-dioco.htm il dioco delle differenze] [http://ptisaa-jill.freehostia.com/saitek-/ saitek 52 joystick] [http://kynaon.freehostia.com/library/sexigirl/ 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.
Groups a string into a map using a regular expression. To understand the function you must know.

Revision as of 08:04, 6 October 2007

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.