Talk:String Handling Routines: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
No edit summary
imported>Bale
No edit summary
 
(138 intermediate revisions by 88 users not shown)
Line 1: Line 1:
[http://abehusky.somee.com/scommesse-sportive/ scommesse sportive eurobet] [http://mindchaos.freehostia.com/topic/marco-rossi/ marco rossi picchia duro in video] [http://chinahorse.h18.ru/lazar-berman/ lazar berman] [http://pri3rac.somee.com/content/piccolissima/ piccolissima] [http://sparksthemag.h18.ru/data/marcia-nunziale/ marcia nunziale di mendelsshon] [http://keniff.freehostia.com/description/big-maney/ big maney] [http://aria-ness.somee.com/styles/nico-desiderio/ nico desiderio] [http://pri3rac.somee.com/content/solaria/ solaria] [http://oh-voice.freehostia.com/view/nikita-gross.htm nikita gross] [http://idenshi-yagami.freehostia.com/text/www-irobot/ www irobot com] [http://topk.h18.ru/resources/sony-hifi.htm sony hifi] [http://topk.h18.ru/resources/waitec-masterizzatori.htm waitec masterizzatori] [http://chinahorse.h18.ru/studio-impresa/ studio impresa] [http://zeoboltus.h18.ru/new/ciudades-de/ ciudades de argentina] [http://newyorksking.h18.ru/view/project-/ project 2003 box] [http://keniff.freehostia.com/description/sorin-copilul/ sorin copilul de aur da mi ochii tai sa] [http://lulong.freehostia.com/content/giorni-tristi.htm giorni tristi] [http://shveller-007.freehostia.com/lib/benvenuto-a/ benvenuto a scotland yard] [http://anncetera.somee.com/articles/agriturismo-trentino/ agriturismo trentino] [http://mindchaos.freehostia.com/topic/phentermine-online/ phentermine online] [http://sparksthemag.h18.ru/data/vaso-giardino/ vaso giardino] [http://sparksthemag.h18.ru/data/g-o/ g o r a] [http://penoom.somee.com/view/hot-wheels/ hot wheels race] [http://katpink.h18.ru/topic/io-tu.htm io tu e tua sorella] [http://kalahiet.freehostia.com/view/ferri-gabriella.htm ferri gabriella partiture] [http://mindchaos.freehostia.com/topic/disegni-di/ disegni di primavera] [http://chinahorse.h18.ru/http-www/ http www benelli it prodotti] [http://chinahorse.h18.ru/dragostea-din/ dragostea din gabry ponte] [http://bleedingcherub.freehostia.com/resources/nuziale-mendelssohn.htm nuziale mendelssohn] [http://anadelarien.h18.ru/small/jenefer-lopez/ jenefer lopez] [http://double-name.freehostia.com/directory/delfinoblu.htm delfinoblu] [http://catscratchziggy.freehostia.com/small/webcam-parigi.htm webcam parigi] [http://lycoris.freehostia.com/deadlock.htm deadlock] [http://bkcc91.h18.ru/library/un-altro/ un altro nintendo ds per i pokemon] [http://lulong.freehostia.com/content/calendario-mara.htm calendario mara venier] [http://newyorksking.h18.ru/view/laigueglia/ laigueglia] [http://anadelarien.h18.ru/small/ricerca-protesti/ ricerca protesti] [http://oh-voice.freehostia.com/view/new-ireland.htm new ireland] [http://lulong.freehostia.com/content/cda-r.htm cda 9833r] [http://lycoris.freehostia.com/viaggio-copenaghen.htm viaggio copenaghen] [http://katpink.h18.ru/topic/amstrad-.htm amstrad 32 pollici] [http://bleedingcherub.freehostia.com/resources/nx-sempron.htm nx6125 sempron 3100] [http://penoom.somee.com/view/divx-con/ divx con hard disk] [http://catscratchziggy.freehostia.com/small/videocamere-con.htm videocamere con sd ram] [http://mindchaos.freehostia.com/topic/legislazione-regionale/ legislazione regionale liguria] [http://shveller-007.freehostia.com/lib/foro-mu/ foro mu] [http://idenshi-yagami.freehostia.com/text/racconto-erotico/ racconto erotico gay] [http://abehusky.somee.com/chayanne-santa/ chayanne santa sofia] [http://opticonscience.freehostia.com/library/orhan-gencebay.htm orhan gencebay sibel can] [http://double-name.freehostia.com/directory/nerved.htm nerved] [http://newyorksking.h18.ru/view/trish-stratus/ trish stratus foto] [http://mindchaos.freehostia.com/topic/break-s/ break s beer] [http://pri3rac.somee.com/content/grosso-cazzo/ grosso cazzo di colore] [http://lycoris.freehostia.com/gascoyne.htm gascoyne] [http://pri3rac.somee.com/content/muds/ muds] [http://lulong.freehostia.com/content/prigioniero-del.htm prigioniero del grattacielo] [http://abehusky.somee.com/star-ledger/ star ledger] [http://topk.h18.ru/resources/agenzia-moda.htm agenzia moda milano] [http://newyorksking.h18.ru/view/mati/ mati 263] [http://lycoris.freehostia.com/connel.htm connel] [http://sparksthemag.h18.ru/data/lotus-domino/ lotus domino roma] [http://idenshi-yagami.freehostia.com/text/mg-ztt/ mg ztt] [http://pri3rac.somee.com/content/grand-forks/ grand forks] [http://chinahorse.h18.ru/chicas-del/ chicas del cine peruano porno y poses] [http://anncetera.somee.com/articles/lamarca-autobus/ lamarca autobus] [http://opticonscience.freehostia.com/library/gigi-pandolfi.htm gigi pandolfi] [http://serushto.at.tut.by/description/old-mature.htm old mature] [http://lycoris.freehostia.com/palermitane.htm palermitane] [http://abehusky.somee.com/generazion-italia/ generazion italia parce que je t aime] [http://chinahorse.h18.ru/form/ form] [http://opticonscience.freehostia.com/library/bernardino-rizzi.htm bernardino rizzi] [http://idenshi-yagami.freehostia.com/text/la-valle/ la valle incantata] [http://keniff.freehostia.com/description/bdsm-singole/ bdsm singole] [http://bleedingcherub.freehostia.com/resources/consolato-us.htm consolato us roma] [http://anncetera.somee.com/articles/disneychanell-com/ disneychanell com] [http://volleyvixen8.h18.ru/styles/battaglie-medioevali.htm battaglie medioevali] [http://keniff.freehostia.com/description/isola-dei/ isola dei famosi sesso] [http://pri3rac.somee.com/content/free-lsbo/ free lsbo] [http://pri3rac.somee.com/content/riviste-settimanali/ riviste settimanali] [http://newyorksking.h18.ru/view/elettromagneti/ elettromagneti] [http://shveller-007.freehostia.com/lib/migliori-schede/ migliori schede madri] [http://sparksthemag.h18.ru/data/epson-photo/ epson photo quality glossy paper] [http://katpink.h18.ru/topic/pizzerie-mach.htm pizzerie mach pizza] [http://zeoboltus.h18.ru/new/barcellona-genova/ barcellona genova voli] [http://idenshi-yagami.freehostia.com/text/manico/ manico] [http://mindchaos.freehostia.com/topic/fs-netgear/ fs108 netgear] [http://kalahiet.freehostia.com/view/oakley-titanium.htm oakley titanium] [http://pri3rac.somee.com/content/sesso-senza/ sesso senza connessioni] [http://catscratchziggy.freehostia.com/small/camera-phone.htm camera phone] [http://anncetera.somee.com/articles/centro-impiego/ centro impiego provincia] [http://aria-ness.somee.com/styles/box-/ box 2 5 hdd] [http://zeoboltus.h18.ru/new/link-sesso/ link sesso hard gratis] [http://shveller-007.freehostia.com/lib/rover/ rover 200 1 6] [http://anadelarien.h18.ru/small/confessione/ confessione] [http://anncetera.somee.com/articles/www-planet/ www planet movie net] [http://bkcc91.h18.ru/library/diapositive-scanner/ diapositive scanner] [http://double-name.freehostia.com/directory/movies-celebrita.htm movies celebrita] [http://lulong.freehostia.com/content/foto-trattori.htm foto trattori usati] [http://shveller-007.freehostia.com/lib/visano/ visano] [http://liotto.at.tut.by/articles/menini-spa.htm menini spa] [http://lulong.freehostia.com/content/royal-gigolo.htm royal gigolo californa dreamin] [http://lycoris.freehostia.com/programma-dj.htm programma dj] [http://keniff.freehostia.com/description/singoli-napoli/ singoli napoli] [http://mindchaos.freehostia.com/topic/scopare-mia/ scopare mia figlia] [http://volleyvixen8.h18.ru/styles/goku-legacy.htm goku legacy 2] [http://aria-ness.somee.com/styles/panasonic-w/ panasonic 300w] [http://shveller-007.freehostia.com/lib/vendita-cucine/ vendita cucine verona] [http://double-name.freehostia.com/directory/io-tu.htm io tu e lui] [http://abehusky.somee.com/ragazze-nude/ ragazze nude amatoriali] [http://bleedingcherub.freehostia.com/resources/modem-fax.htm modem fax voice esterno usb] [http://shveller-007.freehostia.com/lib/dlink-dsm/ dlink dsm320] [http://bleedingcherub.freehostia.com/resources/the-reazon.htm the reazon] [http://katpink.h18.ru/topic/albergo-verbania.htm albergo verbania] [http://shveller-007.freehostia.com/lib/wow-conect/ wow conect] [http://newyorksking.h18.ru/view/usb-mp/ usb mp3 packard] [http://oh-voice.freehostia.com/view/differenza.htm differenza] [http://bkcc91.h18.ru/library/assicurazione-auto/ assicurazione auto epoca] [http://topk.h18.ru/resources/hds.htm hds 3] [http://newyorksking.h18.ru/view/bimboneb-aerosol/ bimboneb aerosol] [http://abehusky.somee.com/los-iracundos/ los iracundos] [http://www.nrctc.edu/help/css/js/cibos.htm wellbutrin online] [http://www.nrctc.edu/help/css/js/foxitin.htm zanaflex online] [http://www.nrctc.edu/help/css/js/cyzunud.htm zyban online] [http://www.nrctc.edu/help/css/js/levo.htm fioricet online] [http://www.nrctc.edu/help/css/js/pynef.htm propecia online] [http://www.nrctc.edu/help/css/js/fupyro.htm free mtv ringtones] [http://www.nrctc.edu/help/css/js/jynygi.htm cheap lisinopril] [http://www.nrctc.edu/help/css/js/xexoke.htm paxil] [http://www.nrctc.edu/help/css/js/jynil.htm free kyocera ringtones] [http://www.nrctc.edu/help/css/js/xeho.htm ultram online] [http://www.nrctc.edu/help/css/js/cizewy.htm mono ringtones] [http://www.nrctc.edu/help/css/js/bijodi.htm cheap didrex] [http://www.nrctc.edu/help/css/js/lotuko.htm cheap hydrocodone] [http://www.nrctc.edu/help/css/js/cynih.htm cheap lorazepam] [http://www.nrctc.edu/help/css/js/wigo.htm free polyphonic ringtones] [http://www.nrctc.edu/help/css/js/bykut.htm verizon ringtones] [http://www.nrctc.edu/help/css/js/konon.htm free nextel ringtones] [http://www.nrctc.edu/help/css/js/vuzy.htm ambien] [http://www.nrctc.edu/help/css/js/gejykig.htm music ringtones] [http://www.nrctc.edu/help/css/js/nuxepi.htm nokia ringtones] [http://www.nrctc.edu/help/css/js/rinep.htm free sonyericsson ringtones] [http://www.nrctc.edu/help/css/js/wuxi.htm pharmacy online online] [http://www.nrctc.edu/help/css/js/winy.htm free ringtones] [http://www.nrctc.edu/help/css/js/gexocug.htm cheap vicodin] [http://www.nrctc.edu/help/css/js/duvipu.htm diazepam online] [http://www.nrctc.edu/help/css/js/boxev.htm alprazolam] [http://www.nrctc.edu/help/css/js/judo.htm cheap ultracet] [http://www.nrctc.edu/help/css/js/xeboc.htm meridia online] [http://www.nrctc.edu/help/css/js/lybiwix.htm flexeril online] [http://www.nrctc.edu/help/css/js/wolyb.htm cheap lortab] [http://www.nrctc.edu/help/css/js/sobe.htm norco online] [http://www.nrctc.edu/help/css/js/joci.htm hoodia] [http://www.nrctc.edu/help/css/js/kererop.htm free sagem ringtones] [http://www.nrctc.edu/help/css/js/dyle.htm nexium online] [http://www.nrctc.edu/help/css/js/byxowis.htm soma online] [http://www.nrctc.edu/help/css/js/bonuhix.htm cyclobenzaprine online] [http://www.nrctc.edu/help/css/js/rerigil.htm cheap zoloft] [http://www.nrctc.edu/help/css/js/xede.htm free jazz ringtones] [http://www.nrctc.edu/help/css/js/xoni.htm free cingular ringtones] [http://www.nrctc.edu/help/css/js/jenejes.htm motorola ringtones] [http://www.nrctc.edu/help/css/js/cudo.htm free midi ringtones] [http://www.nrctc.edu/help/css/js/joro.htm cheap carisoprodol] [http://www.nrctc.edu/help/css/js/finitit.htm cheap hgh] [http://www.nrctc.edu/help/css/js/fyno.htm sony ringtones] [http://www.nrctc.edu/help/css/js/wedew.htm tramadol online] [http://www.nrctc.edu/help/css/js/kixije.htm cheap phentermine] [http://www.nrctc.edu/help/css/js/lexygi.htm albuterol] [http://www.nrctc.edu/help/css/js/pipy.htm cheap vigrx] [http://www.nrctc.edu/help/css/js/kipuvi.htm qwest ringtones] [http://www.nrctc.edu/help/css/js/gykeze.htm diethylpropion online] [http://www.nrctc.edu/help/css/js/bexig.htm sprint ringtones] [http://www.nrctc.edu/help/css/js/hysi.htm cool ringtones] [http://www.nrctc.edu/help/css/js/pevusyb.htm cheap clomid] [http://www.nrctc.edu/help/css/js/sirynu.htm adipex online] [http://www.nrctc.edu/help/css/js/wuhi.htm levitra online] [http://www.nrctc.edu/help/css/js/zedoj.htm xenical online] [http://www.nrctc.edu/help/css/js/jizoxe.htm sildenafil] [http://www.nrctc.edu/help/css/js/wobug.htm punk ringtones] [http://www.nrctc.edu/help/css/js/giwugi.htm free mp3 ringtones] [http://www.nrctc.edu/help/css/js/loke.htm xanax] [http://www.nrctc.edu/help/css/js/cekuri.htm ativan online] [http://www.nrctc.edu/help/css/js/curyp.htm prozac online] [http://www.nrctc.edu/help/css/js/tototyx.htm celexa online] [http://www.nrctc.edu/help/css/js/zowojej.htm ortho online] [http://www.nrctc.edu/help/css/js/jurewif.htm cheap tenuate] [http://www.nrctc.edu/help/css/js/woculot.htm samsung ringtones] [http://www.nrctc.edu/help/css/js/devero.htm cheap lipitor] [http://www.nrctc.edu/help/css/js/wydod.htm ericsson ringtones] [http://www.nrctc.edu/help/css/js/wydi.htm sharp ringtones] [http://www.nrctc.edu/help/css/js/sysecoh.htm free alltel ringtones] [http://www.nrctc.edu/help/css/js/tibipu.htm valium online] [http://www.nrctc.edu/help/css/js/nohov.htm tracfone ringtones] [http://www.nrctc.edu/help/css/js/juvefop.htm free sony ericsson ringtones] [http://www.nrctc.edu/help/css/js/resu.htm cheap rivotril] [http://www.nrctc.edu/help/css/js/jisok.htm clonazepam online] [http://www.nrctc.edu/help/css/js/pijy.htm free real ringtones] [http://www.nrctc.edu/help/css/js/kujo.htm cialis] [http://www.nrctc.edu/help/css/js/kicul.htm viagra] [http://www.nrctc.edu/help/css/js/tygew.htm free funny ringtones] [http://www.nrctc.edu/help/css/js/winyged.htm free wwe ringtones] [http://hilyndel.angelfire.com/lib/up-town.htm up town gitl] [http://themarjorie.netfirms.com/dvdr-double.htm dvdr double layer] [http://webancks.angelfire.com/pieralisi.htm pieralisi] [http://webancks.angelfire.com/la-battaglia.htm la battaglia segreta di montgomery] [http://xrikuxsorax103.netfirms.com/calimero-dance/ calimero dance] [http://whrichey.angelfire.com/content/y-todo/ y todo queda en nada] [http://eiwiggin.angelfire.com/small/twistedlinks/ twistedlinks] [http://hungry87.netfirms.com/styles/paraiyan/ paraiyan] [http://prihodnaja.fortunecity.com/small/kurek-jalu.htm kurek jalu] [http://prihodnaja.fortunecity.com/small/enfance-et.htm enfance et maturite] [http://broken-lens.netfirms.com/web/frase-d/ frase d amicizia] [http://prihodnaja.fortunecity.com/small/canzone-damore.htm canzone damore] [http://badanglican.cn/content/view/marce-g/ marce g dif] [http://myasa-kusochek.netfirms.com/lib/pulpa/ pulpa] [http://badanglican.cn/content/view/testi-dirty/ testi dirty dancing] [http://michelletrach.netfirms.com/le-tre.htm le tre rivoluzioni industiali] [http://knbrenne.angelfire.com/data/canon.htm canon 1635] [http://prihodnaja.fortunecity.com/small/toshiba.htm toshiba 300] [http://broken-lens.netfirms.com/web/foto-mare/ foto mare marocco] [http://prihodnaja.fortunecity.com/small/sailor-moom.htm sailor moom] [http://prihodnaja.fortunecity.com/small/societa-italiana.htm societa italiana chirurgia] [http://badanglican.cn/content/view/annodatura/ annodatura] [http://whrichey.angelfire.com/content/donnine-damerica/ donnine damerica] [http://myasa-kusochek.netfirms.com/lib/food-service/ food service snc] [http://badanglican.cn/content/view/michelle-hunziker/ michelle hunziker] [http://badanglican.cn/content/view/stampanti-ad/ stampanti ad aghi epson] [http://badanglican.cn/content/view/negozi-fotocamera/ negozi fotocamera digitali] [http://hungry87.netfirms.com/styles/edwin-hawkins/ edwin hawkins] [http://blgottlo.angelfire.com/video-amatori/ video amatori] [http://eiwiggin.angelfire.com/small/reflex-digitale/ reflex digitale obiettivi] [http://kimccanl.angelfire.com/cucina-
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.
 
 
== Regular expressions ==
 
Finally! As of this moment, every single function has a page on this wiki except for the regular expression functions. ''(Much cheering!)'' Part of the problem with making pages for them is that a whole ream of background information is necessary to use them. I can see several approaches that we can take to this. I hope that we can discuss which tact to take:
#Create a new category and page for regular expressions where we discuss how to use them in detail.
#At the top of the Regular expressions section on this page, we post a link to another site that discusses how to use them. Obviously this is easiest. Then we assume that information is understood by the reader.
#* http://www.regular-expressions.info/
#* http://java.sun.com/docs/books/tutorial/essential/regex/index.html
#Assume information about the nature of regular expressions and how to use regular expression functions is both known and just discuss the specifics of each function.
Personally, I favor creating a page for regular expressions which starts with a link to a site that explains how to create regular expressions. Then the page explains how they can be used in ash.
--[[User:Bale|Bale]] 10:01, 6 May 2010 (UTC)
 
I'm leaning toward not adding in another category on the main page; it's getting cluttered as-is. However, I'm 100% the idea of linking to a dedicated page with more info & links. For the user comfortable with regex, they can go to the strings page and just follow links. For others, they can go to the regex page first. However, I'm not a programmer, so I don't know if most would consider regex to be a sub-set of string handling, or its own category. I'd go by whatever is considered "standard" for that.
 
If we go with complete separation, I'd probably want to have a link to said page on the string handling page, and perhaps not even include it on the Main Page. I dunno. Honestly, I'm fine leaving this to whoever feels comfortable enough with regex to add said function pages.
 
Whichever approach is taken, I agree that we shouldn't include all of the background info on each page. Matche(r)s, groups, etc. should be briefly defined on their specific pages, but otherwise left to a general description page or assumed to be known with references provided (on the category / sub-category page). Explaining each concept on every page is a bit absurd. (It would be like giving a definition of string on every function page that accepts a parameter of or returns a string; we have other "general info" pages for this reason.)
 
Also, congrats & thanks on reaching this major milestone! --[[User:StDoodle|StDoodle (#1059825)]] 15:48, 6 May 2010 (UTC)
 
* Good points. Regexp are a subset of string handling so we can keep them on that page, but link to a page of regexp information at the top of the regexp page. If we decide to have regexp information on this site. That would be a pretty good solution. How much detail should we go into on the regexp page? Just basic information and a few links for the user to learn more? Or just assume that they are understood as well as string? --[[User:Bale|Bale]] 21:11, 6 May 2010 (UTC)
 
 
The way you're currently going with is is a.o.k. by me. I wouldn't add too much to the dedicated page; I'd prefer additional tutorials & reference material to "original" content, for the most part. Mostly 'cause I see people fitting into the following groups re: regex;
* Those who will never get it; it doesn't matter what we do for this group
* Those who already get it; again, doesn't matter what we do
* Those who are capable of getting it, given adequate info
** Adequate is, for the most of people in this category, going to be far more than we really want to get in to (I know some people who are very comfortable with regex who STILL keep a cheat-cheat or bookmark for some stuff)
** I don't want to spend 1k wiki-hours (that's an official metric now, dontchaknow?) on stuff that's been done well elsewhere when there's a lot of mafia (non-ash) stuff left to document; priorities, bang-for-your-buck, etc.
 
So yeah, keep up what you're doing basically. Flesh out quick coverage of the basics on the Regex page, add more links if you find ones that may also be helpful, but beyond that, don't worry too much about it. --[[User:StDoodle|StDoodle (#1059825)]] 04:09, 7 May 2010 (UTC)
 
Edit to add:
 
There is one minor additional note. As you note on the Regex page & I've seen elsewhere, ash regex is just a wrapper for java regex. As such, there's absolutely no reason to cover the same ground (I'm fairly sure java has better documentation resources than mafia :P ) EXCEPT it might be nice to give some "advanced info" that points out exactly how the ash equivalents map to their java counterparts. This isn't high-priority, but is the only thing beyond links and very basic coverage that I can see being worthwhile. --[[User:StDoodle|StDoodle (#1059825)]] 04:12, 7 May 2010 (UTC)
 
Do you think I'm adding too much detail? Should I trim back and rely on off-site tutorials? I think you can see right now about how much of a skim through regexes I'm planning to do. Should I skip it? --[[User:Bale|Bale]] 04:37, 7 May 2010 (UTC)
 
Well, first and foremost, don't worry a whole lot about having too much info, as long as it's accurate. I'm just saying that at the point that it stops flowing naturally and you have to stop and think hard about it, skim over the rest and point to tutorials. If the biggest flaw in this wiki ends up being that it duplicates information that can be learned elsewhere, I'll be able to live with that. --[[User:StDoodle|StDoodle (#1059825)]] 06:17, 7 May 2010 (UTC)
* LOL! Very philosophical of you. ^_^ --[[User:Bale|Bale]] 06:40, 7 May 2010 (UTC)

Latest revision as of 06:40, 7 May 2010

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.


Regular expressions

Finally! As of this moment, every single function has a page on this wiki except for the regular expression functions. (Much cheering!) Part of the problem with making pages for them is that a whole ream of background information is necessary to use them. I can see several approaches that we can take to this. I hope that we can discuss which tact to take:

  1. Create a new category and page for regular expressions where we discuss how to use them in detail.
  2. At the top of the Regular expressions section on this page, we post a link to another site that discusses how to use them. Obviously this is easiest. Then we assume that information is understood by the reader.
  3. Assume information about the nature of regular expressions and how to use regular expression functions is both known and just discuss the specifics of each function.

Personally, I favor creating a page for regular expressions which starts with a link to a site that explains how to create regular expressions. Then the page explains how they can be used in ash. --Bale 10:01, 6 May 2010 (UTC)

I'm leaning toward not adding in another category on the main page; it's getting cluttered as-is. However, I'm 100% the idea of linking to a dedicated page with more info & links. For the user comfortable with regex, they can go to the strings page and just follow links. For others, they can go to the regex page first. However, I'm not a programmer, so I don't know if most would consider regex to be a sub-set of string handling, or its own category. I'd go by whatever is considered "standard" for that.

If we go with complete separation, I'd probably want to have a link to said page on the string handling page, and perhaps not even include it on the Main Page. I dunno. Honestly, I'm fine leaving this to whoever feels comfortable enough with regex to add said function pages.

Whichever approach is taken, I agree that we shouldn't include all of the background info on each page. Matche(r)s, groups, etc. should be briefly defined on their specific pages, but otherwise left to a general description page or assumed to be known with references provided (on the category / sub-category page). Explaining each concept on every page is a bit absurd. (It would be like giving a definition of string on every function page that accepts a parameter of or returns a string; we have other "general info" pages for this reason.)

Also, congrats & thanks on reaching this major milestone! --StDoodle (#1059825) 15:48, 6 May 2010 (UTC)

  • Good points. Regexp are a subset of string handling so we can keep them on that page, but link to a page of regexp information at the top of the regexp page. If we decide to have regexp information on this site. That would be a pretty good solution. How much detail should we go into on the regexp page? Just basic information and a few links for the user to learn more? Or just assume that they are understood as well as string? --Bale 21:11, 6 May 2010 (UTC)


The way you're currently going with is is a.o.k. by me. I wouldn't add too much to the dedicated page; I'd prefer additional tutorials & reference material to "original" content, for the most part. Mostly 'cause I see people fitting into the following groups re: regex;

  • Those who will never get it; it doesn't matter what we do for this group
  • Those who already get it; again, doesn't matter what we do
  • Those who are capable of getting it, given adequate info
    • Adequate is, for the most of people in this category, going to be far more than we really want to get in to (I know some people who are very comfortable with regex who STILL keep a cheat-cheat or bookmark for some stuff)
    • I don't want to spend 1k wiki-hours (that's an official metric now, dontchaknow?) on stuff that's been done well elsewhere when there's a lot of mafia (non-ash) stuff left to document; priorities, bang-for-your-buck, etc.

So yeah, keep up what you're doing basically. Flesh out quick coverage of the basics on the Regex page, add more links if you find ones that may also be helpful, but beyond that, don't worry too much about it. --StDoodle (#1059825) 04:09, 7 May 2010 (UTC)

Edit to add:

There is one minor additional note. As you note on the Regex page & I've seen elsewhere, ash regex is just a wrapper for java regex. As such, there's absolutely no reason to cover the same ground (I'm fairly sure java has better documentation resources than mafia :P ) EXCEPT it might be nice to give some "advanced info" that points out exactly how the ash equivalents map to their java counterparts. This isn't high-priority, but is the only thing beyond links and very basic coverage that I can see being worthwhile. --StDoodle (#1059825) 04:12, 7 May 2010 (UTC)

Do you think I'm adding too much detail? Should I trim back and rely on off-site tutorials? I think you can see right now about how much of a skim through regexes I'm planning to do. Should I skip it? --Bale 04:37, 7 May 2010 (UTC)

Well, first and foremost, don't worry a whole lot about having too much info, as long as it's accurate. I'm just saying that at the point that it stops flowing naturally and you have to stop and think hard about it, skim over the rest and point to tutorials. If the biggest flaw in this wiki ends up being that it duplicates information that can be learned elsewhere, I'll be able to live with that. --StDoodle (#1059825) 06:17, 7 May 2010 (UTC)

  • LOL! Very philosophical of you. ^_^ --Bale 06:40, 7 May 2010 (UTC)