Talk:String Handling Routines

From Kolmafia
Revision as of 15:34, 21 August 2007 by 208.255.68.245 (talk)
Jump to navigation Jump to search

paglialunga cartuccia epson c60 notti di cabiria km0 rover discovery auto km 0 pelicula titanic orologio fasi lunari due assi nella manica laface enzo indesit wp 100 gigi and molly heterohyrax volvo varese buzzle dipinto paesaggio natacha galeria gratis chicos famosos neger bums mich moto mondiale r 1200 gs clara morgan nuda di max de angeli oakley crosshair work manowar wheels of fire gande fratello uk mulinello surf il croccodile come fa la colina de la vida de ataque 77 kenzo eau coppie over 50 grasse polistirolo prato polo jersey uomo t amo ps2 gt 4 laser hp stampante enterostomie frigorifero coca cola rossanna mitsubishi - pajero golden sun the o c telefilm palm te2 tamron 28-75mm gci net finanziamento berlin www aduc it reyno animal s3 racconti erotici moglie porte chiuse cooperative edilizie torino dying diana one t ft cool t the magic key epson stylus photo rx sms gain villa santantonio san remo 2002 profumi gucci spia spione calzature donna inverno 40 prada mercatino trieste ministerointerni the battle di hans zimmer apple mouse ingresso videocamere adsl2 firewall router giochi di avventura 3d distretto militare di salerno racchetta da tennis dunlop jonni giochi demo di strategia arei prealpi srl tammorriata pugni chiusi fr david kinkyman auto noleggio vigevano luci e ombre per il tokyo game show autunnale cachorros foto donne comuni nude stradale belluno volo lissone cheap obiettivi canon ef 55-200 dsc t7 sony photoshop 8 rav4 2002 tesi scienze statistiche reale mutua assicurazione racconti sculacciate rh 7900mh confessionale calendario costantino hydromania newport hotel amplificatori valvole verona trapano black decker cartuccia oro air 3 bud asus pda phone sostanza dimagranti fred dal whisky facile rs mmc card 512mb dual jvc gr-x5 albergo 3 stella copenhagen played a life safari duo fatto o rifatto film gratis animal sexi copay secondo www gemidos com ar novoaltajsk tanto la queria de andy y lucas lg direct drive lavatrice custodia chitarra manuale philips ice-shelf linea mani lancome testo pgr engher eva cellulare supporto auto sedia iroko la natura in goethe pioneer deh-p8600mp kobayashi, issa te quiero te quiero lancia z defend km0 chrysler pt cruiser auto km 0 video free hard navigatore satellitare gps batman del futuro ferro da stiro delonghi chatta erotica in due parole meka gianna singole quadri courbet don t you worry www it vodafon it cagliari milano linate biglietti aerei hp 5590p toner epson al-c2000 bij 2300 donna con lui cuckold nuovo colombo bonders xxxporno ms office small business epson aculaser al-cx11n nike air max automatic porno animali www il fiume po it tutto wind ram v-data igiene degli alimenti mp4 player televisore vendita john jeans dana skully passeggino chicco trio s3 top in partibus infidelium incontri a agrigento nikon 12 24 roma vienna wireless schede acquisizione e tv giada de blanck xeon 3 4 lagosto di cecchi gori - 2 teenage superstar power color ati radeon 9600 pro rimini rimini senza mutandine battiato voglio vederti danzare risng force oceaniche chanel egoiste platinum mamas and the papas california dreaming nees von esenbeck, christian ... il passaggio del reno singoli 2004 i m just a gigolo suzuki gsx r 600 del 2001 m jakson nomination srl j terni canon - fotocamere digitali eos 20d ef-s giochi porno per donne fucili subacquei diving pesca rastaban www parseek com kings of con marlowe indaga le foto e gli avvenimenti della vita di hamlet notebook stampante epson cd scienze giuridiche delle relazioni inte liquido per allontanare i gatti macchina hot dog musica italia 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.