Jump to content

Help with Regexp


developerphp5

Recommended Posts

I need help with regexp to find the number of occurrencies of the string "join the nmi team" for each line.

I tried it but i cnat able find the good one.please help me out.

 

 

oinj oin the nmi team

jjooiinn tthhe nmi abcd team

join the nmiteam

jjjjoiin dse thehsethe namanmie team

teamjoin tehsthe nmisa team

ia nejoiiatj tm teeathneni iaennjm iihomhh nt iih jianiihett hnthtajimjnt tit tnjeaajjoeae m temotm tmtiamh oiaomejjao tm ennetmnee oinmtn h m hn in mtj mi jnninei meai hhmeiteh jaitamhnteonntm emn mjijmjntemt a hnimeioeiheh hmmjmiomi neojhjttnm eoeetn nemneiin iime e t mjjmte mtnent nm eitn mni einiii t inoeomjenntmja mn ne mjjt njejnnnijmmj e tttnoaetott tejooo omom o ai hjni mmia m etm himat me oieneim it meniemitmin oo o jinehinjinta th meiim tenjmi jn ihmno nn ai n mntitmmotni

nm hiato emjjhmimnimhm ane memmnttooana mmami teinehmtmt htaheoinnto mh maj imnnatn tm matiime neiahotee mtoi hhenjaameiimio e onn iman tnioao ioejot teeneiietiotomtmmttj hne jemtitmnnieteeimmmjntinimmhhieen e etimjtehi jonjittthatmtiiijth tt attnnit iei m eehntitmtt neomojte mometji iimo httjmttmnmtimai ha enn nht jttnimai nm tmoeajoihjeenioijahoi mthnai ea ejatjjehoa mnttmnniamtitanmmeai ajjao tientjanmittj iijn jniatmttjienmnmntmeamnimnhm ei etntiiojntettmtttttnhtatatai oinee ojmone

njn tnentjamm n n m hn nie tm aj eet a hemaoimoej nnmj jmj ea iht i n onentottonmtnjtej enntjaihh mnt t aitnaetathamnmhj ntnemme mejhn tm notoeij ajemnetia o m ijot hmaeemnmeajhtj tmin m et n itnje at i hjt ehmmmiii e niojm enttj m eaeenn nnt nenea jmtjnnaihnioeia ntmi iejet tnmtt hht i i thioa jjjniennitah nn mntaoehtn ietjhtoht nath n eeamj amnthhjnntmnmimmene nnmtje me ihtei it aoinjomnm t o it monmeomittetehejaaoaojienemon nnh itttmooeamt m moi itmitnthetnnoimeeamnte im e n m ene

minmm iniiemoeie inaiei ai ahaotemejijnmm jtite nmihhnnet ieojeajma nn tnnteteiie iiometitei tnt en memihemie ti jhnmehoinnajen etjtmmmjomnmh ie oe atmomtmjnn om amhame eeeto eiihjamiatoaj io hjeta hti itmnaoammeoaiitieetiet iijajtm jh n tenttt m jia enhnojeoaaennea mitehit htneeomeito tmt antoiinmeho nemmiiho tmamommjenaijjtimmnjjtmatnnmain iia tatno ao thnte ijian e hotjnitjnnni itjhmhnaeeoejme eaiaiiihaim hi ne aji mmtjetj oanntahm i tna oh jee ehe n h nmenaihiaaoem ijao h he mh

etmtmmnn tninetme enhmnehhmmtatnain t jit e nttimiinjjmmm nt emem nmmaitintemonmnn neainea eettiatot aeintiteinjnt miheittjnmeh m ieieim men eh ojm eoeioo me nm ihn onjjjnnanejntnhahnj tmmnnaontt entenmj ne imjnneommenamoeotnhomaeo eomea nnnoojnimm emhii aoe jinnnm mnjnonmnnea eihono meoeetjehiahnma ohhme maojihj eeh tii jtiamneo teemme jaihaietjitetmmt ie ia atmnt othn ammm et hhtmim iihaj nmojieheiit i moat mtn emi hnoe emmj htno m t nooe e e n tim mi e en iitjito nhne onet

jo nmtionihiiaheie m naemiaem e eteoeo t mioth hj nahnj jijah tithohiaimm hmtitene njttoetmett m mjh nmoeto jhon t tmnhohhai etejhtnntmjii iotttijitmjejetiinjmnee jnhototeii ttimeneei iteneimeemjtihejtjinn hioean neeh mtanmheiinjjneo emtetain a ttonma inejnjn oiiihntihoojtnmjetie omemeetamomono tainm n tntin menm ie mtij t hto m njian heometoeoontieneea ie emnjmaaeitin onhmm ihmmmj e m noheojtjeetnmmmnmme nohnieom eenn inmiojjmim eme ommnmite mtieatomn i hen hmnja mojehjn eiem himoh

ttiejm jn ma jmihmtetei nohiite nmhmnmmhantnmttj iaoone ineejatn i htithe mttmj einemeintmnntt jmee n ojnjtjje amotmm i h tineoi enma nmj me aee tt aon mjeten ihii at mm ttimnhhmitotmitj nnmtmi nne ne ttemm hmhijit jtn aimeeoohamatt ii oemot i menaotenh o eeheh ieaamt jitimhmitjmn tattttnnnmmatet ntttiamnaiaaoonejn th mnea nttmjm htmttn emtijtntimtonnjieemeemi htm tomtit i jttea oai tiai oaoa ennej i jenomna jmen nteeo tnh jmeemijiiehn aijmienminjnmnttmmene nn t m aoioomnnet hetjeieh imnhit

i tneae j ntnt hm etnn i it ttjmm ej t jm ehi o i tae mijhmjman tnmo m neontnimeehttah atemth ijnntnmeojoe tjonea ttmnihnmtina eioiomtijnht jie m neeetmijna imntmmmmntteeei tijetait tatat nt h etimi o tntitt i neentnei jameme tjheiait emntt n ooannemohj t jeiemoj teahnnmtmtaj enijtojjeto maijmmeeanoiteoi ohnto iitijo jieomeaeto ahnjoietm niietimoem ejh mtmjtoaimmtteita mmn nhinonm tn hnm ti iea emienm otemem a tniheiaithtntnmnnmiomhnatehtotna hhi inehahtomm onit mie itiijejhmnnn

hmot i naetoi jtotn o monm tnjmmmjt n ih n tmjheooen tioh jh oijti j i na emm o ntjhmo io nn namjai haiitmt ojjohjni t n ohii hei ntjiina nmeamjo ttmetimihih mjj hoiommeinio i o nm amh otmjejn o hianeeammiin meiatmtmion mmtnimnh tnaiiattooan teho onotiiiht mi anejothne mommnojhientjai atmmiio eoe hit ttiehojnmennmmetmj ii hmheitjj ttaiim amniinonhoman imin ht hmti mh i o hne t mhieotetaannent t ieeaaitineaee m ht nniheom e mnmematin noho ijtjh mnio itiamiehm tmnnonmm mh janmonihej

tmnihthiohtmeanjieeeatmneinej tt neitete oo jttnnnmonmmmteetonmh jjjat ianamaiioetihhthimnm enoiminnai e mti mno h iia i nenieiemmni tt an iimnnoiohe mae anhaeamtiammeetiettmmete mhneejhoe ata jtai ehm n nenaen eni maett tmmjehe mnjnm hii iininninii meen eea ia eemenio tmhjtjnmniaj enhaeintit n nihmen enoahjooaimhim omee iite thamm n mn imit o ntmtnjntne ahnt nmj imthtmoiniihe ni mem hmti ei mtaa nathoaj h ijnejjjtejoi mt noh tmhnm jmatimeojeit iahheiae tmjatmaeiatjn jjnja ene n m no

m jjhhm ntnjth eejeht nmeiaoaoieniaa n th otnm tijnnimhno i inhjianhiethmnmaea a m onttenejmenajnnetmtan tee h mjjonthjaejat ettenihmjm tenotaoeaij njnhoi tmjihn tnt miiinmottj etje emin mnhjeitimnmo tt ainaihnnn iieeejoeon an emnimanm te jo i animmnjiomhne nmain tjjme imntniaao iinoji tto i ti mn mn m eeiahijj ioemhn i hhooijiiinhimn iieenantmeahiijhje imnt njiejahij nioni nnimnnootimimtiiiinoenttteehmmeiim ntt hm ntnam mtt ii n t hemhnhnjijn io memnnttte emtht j eh tjjjo htate

iiieoitomie ii jennt nth t n ohh jeenimnehe nnnjhotimmjem hnetmmeeejmh etimhe h mnmntmot emn nnojmimjhjeomnm m otn mithath oainmttnh mntmetojjntn ehettiit o ajtnmim h etnmtnimtmjnee omtejt ommi aaoitan ahnnh jn onnmnhitmiminatn h eiht an ae jitmaiinmtntaiioea thiiihmhenemm mmhm n mtm atm iijjt nnhmoaei mmoh hanj i maotmnhijien thmjaaij ahnehama njei ne ti eitnotijei hn emheeaja niaje aoe tm ejmmttitnoimmjmetem eemntoeoeeneen am o i hn nnnjmnmttjh emmenome in ttnnitjah mh nitnonmonemteojn

inhm ainmma n tomnioiiit mmeinnna menneteoh e iei mtamtint ej tn i j neman hemnmnt iiomihe em ttjttmtenmmaea e tmj io tetntmem emo t j eamhhoenje nmnje n hh ht it atiniomjtiejee e tej thmotttaonea hjtmjiiai mhj ejmiem n nieoj th ihttj jnemm it iemmiihitnttmiiito oiniiiomitem enom ijietmmjthie jmm nenm jeoietm etmnmnn atiemioneeo eonem mto mm intte imi o tmoa jammnm tej hjo ethtmia atemee te enjt t mtmhmetehetmmnmhttttm jjeot ti maetn omint etoiiiai htooontooieie mooahnemetioehj

ioeai mteoej oej omeio oein nhmm i omh memeatmmmeijt a aijinmtehaiea mahnt et tiatei mmemtemn m ehhatttemmiae ott j oaeetjemmajhtmimtn a nt motoo nm ot a hmi met hnni jemm mjan ma e aehmtnaomet ntiimiai amtmm ioohma m a t mo ieethnnjtomi naetmntaaamehhth o a t omteoaoeij ema eei jeoehiati nt enettimthhttiintiae m ainntatmmiteeoieene emaotnjiommmiinmomn mhio t aetm tntioetittimahamte meeotnmnjmetthmeee m jtnmiom ni hnmi natn n oianmnienmjnoiim tooh toa eoeemnm on janjitn maoojettni etm
eh eanmmeino ihamhtjet nmjaie o in jihimj j aeietea heeehjeioi iete mt nejitijiomhhhe tn mthtmjmaeeaiiini ettma htinneetotnehne oti tmnieaihnnie n ijtmnitemn m ejnjm aeie i ttti m neaiaean a tnetjtmi inaej ii ihoot jinneia ihni nh tnhnmme i i menmn tjei notnt n eiij ta emtjjtmmoemmih niijn tjemontjieetm taiamnnmiaeamiath te ejne htjmtham anee iheoittaint iienm ntee ihtjnn ioat inhimoemnhmoahmhii eimja je imenteiio nih ote n mn njeneaemntie ejtomeeo ta eejneomm ntioo meijmnmoiin

mt itmnmj mmtitanann tnhnte j ohennjhnoitoeaatit hnenmhthieehattimenimnmjiaajo nethm ttieiotoam e ejeoj ah mi eeihie taee mth neo ti tennmntem njem tamnmmnme eajnj ma i htnahiaoee ietneiatjm o em m eoatttij emmoott e t ntnetnnhjm aee me atoeein imm oitimn tm e nahm hnn m e eo ana e to th emmnnoej jm jhn e e et teeeineejee jnioj t ij m m tnoiont hi em ainmnaijiejntti o iiit mjoitm teajtim iitneo jmm tno ion hnjnhannoi ntoeiimitnnjthitnnhenaatttm eonoa ne nj tahiemntnenm ja ajemm ij

thj ihijnmioae it ii j mjiinnenj m amem jmnmeoo h metiehhnanh nioeno nm nn mtheimtna h eanet jmeenaiinettimoje mitni ejmoemtemmtnneiiemanmmnt nejtm mmh oh nhiea tmenm n tte h amimjoine etj aea miotmht itt m tt h oe it omnm eimejhtn o htnii omtah jinit jneme j itehiimteta otehejamei e n iineht t mhttin tminenoejtnajteiemittemthminit tiiietmenntmtn ien eitnieee mtjmmne ittioajtntemtme iiio hjteitmint e nt em tmm jonitnt mejjntiiheina memm mntnme tnmoenm n t niitamoaoietmhoemnm nhnohiiaj
aoimem n tntie n tj aeimthi emtin tntjnaatimjamoee iet jmoeototeajmmnnae ai motenit ititmti nmimmminnjajam aiehajii mh niit mmtnm einhnem him mma temeet ni ehtht aiihie tj hmeim te ohem n enaijte imna neieeeeiiie jta ehjtjjoet emimnn jenen nhmnieoi eim nihjanjotninnoiomamjeii ejijmnntm nt tmemniot inhio he neen iet jomhihtaoe toeitninheh amtnometma jmih nt jannitaeih e a emei n nmeiemea minhjonhtji noian ejajema jtmiaiomnmhnijta jjimnehmth mtmjimiji jhhhmjhtmetmn moit m tmtamjm m

oihon eimmontmihteeh ijjnmjnttnema iit mhe jmitjnntnntteetiiammti e j eeniethneaemimhae mai mh ee ititjoihtm nhhmte m it m iaijitttitati tmjthetitntt onhe j htonmeitihnoha e iit mnn ah iejn o ne i o im hmjammeo ehi hnjem je iote ti noamm nem tmhmtnmtnhthm emantn eih ma oneh tmehmimm tmmtmejae oa tmtthneni mthmteahtijiiaini oamaat tmo itimn jiiehinjoi mtimnn ee nhahnen mnatetamtjin iaemimhmeiinjn aojnimto om tnmeohj heennjemninmnotihhemejenneit nmiee toee mmjtthnme toei taehnmthtt

iihinot oneett jmh o inm iei tnoatiit iiommontmeeejm imeiiietnim mnnoamje mntemnen n ijht i aone imntjjnmnaoeonht i t t tmt jhmtnn tmnantttmaaj iineimmeatimn t teoahmiit ihthjanennej n emti m nj tnjtmii oimmmnionithi taamnitmhitea ooei jtanmjemtttoi m inenimmmhoit mejaoma mnthteo nhe jhamm oijtietnmteemi hmne he oi j tntoeneeitem ntonnntaenjn nmmje nneoet mohneanmeon mmejnonionjetnieimt jieammeojhtjhija njtojia e atjie ntt mhnm nhan io ntiin eetannmimaimtnmjtmmtnie mittthemtnnheinho

nmeemenne nm nmo eehonnmmmtiheth m mniet enaome jtn hnehmjtthnoineo jnj mnmjnon eo thi heo mietmanjen eihetejntionee iti ntahietiet mnhmiihi tttn nan mom hte nietjee ijmmt ioeoioi innemjaemn hmnehemhta ooean jenioeiiejnjmtena n mnnimtnn jnhn emhioh imjnnaetiotn tnjtjjaeniee jma oatmi ahnineihei imah tn tiin otanjhiememtmtnioitimihhamiot tao oom nno hjemnat manm omenhin thtemajihh mantetnmt hamto ott i on tmin i eatinoit j ti h jentmt ttitoetn aa jjn ott nntnomtoteemniihm iiimaim

i ejtith t tmminiten one tteetono nanj aej mhi nn mi ha tinhamainoitjjtt hnnie ehhat nnmaojt ma oojooeam iten emattimttehtio nhtmea ehnmimniennmt mmn jtiooi ataeon m tmta ime it emitn nemeioie aio mm onmt mn eham eome hmenenejmmmn oitaa en eotm entimtm nnm ia mtaa en jamonnmitmtttt nt t ij hnimjatoeanoit mtn otjmi hnheeitiee t tmimiethtnani m meii omea tmjoti ttmn eiijemmiaeto aiiemeiaen im emoij ejotmnioj taha hta tomao hinn th aihoteonnjmitt imttmnaomnii e jtihe enjonjntt jmjtn ii

e tjntnnonmnieo am imoemjatmie j nj tneetejeionn miijnioeeimemmmniea tjnt neitii tijet a ote hjhnaim i mn ja inmm mejet nom emiietmojiine otem ee a metihnih t metmnjtete m j ht jtitjoaienmithjhmonheoi nimae n oeeoat hmnjtnoi itajhj mi am oitmmeati tetneh mnoem eoejmtieetihtm m nhiean m eiteinnm imajh i n jijn iee onmtnjmtmnj a eiamniih aaitmeeejnhoiniineninotiijethnn e mo jatntet nmijnt meam mee tiehae ijnntjit n etiai im jemtjtiaiani ij hnea aiathmmthmnh nnmiea nhenaoai tae tneeintohi

hmht n e ittnhn ajmt h htinm mtinieth tohohaemihi ininn eoomja monaea nttm nai itetnm ejhojttihjnemth oh hahjn hmtmnmhnjemt en im tmi hieejjnjmehieetnioahm mi ieeoooetntemnenhnh oien hm a hehe ahmiat eti nj inme h tt i ijmmatmm ai t ejj n nmnaomneimjnaii ie mh mhnniao imeiniti ohmhmhat i me jo imtait t emiii tiiijahiimjhjoiiomjnt tni t tjhmnhennnnnmnim m ma e im je eaetonii n tnemtnietmheoinihnneh iimae mj antejan nnej mmmhinnnja mtnaemetttnei taanmnnnnni tnt ah mo a i ojn m

h monteeonh oetja temenioii miieit amht mi onji n t tamentinmhjmin taeoantmotimamahmtjhheomtemei meetnhhehen joom jt enh inaiioimnieo tae ohti injnmnnehth eeijj ot jinoje oajiojhietee a ea ehnihn not nitttt motehntimnj ahiiaaniiehetn i jint aj mj m hjn ai mtnmnmie em tjeh jhtiai oii e jmn nhio mntietmnoimet mjmiieoae iotnthtemnmetnjeei ii n aanjee m ontet hahn n ihaanonttoiho te tmomhehtttjmtt ntthoi t mtt emea ttimiei tmn tenimim n o miieemninan nhnteenijii temn emhtohnna iio
hememiaitmj mn oe i jtmmm o itto tm ame mni entnanmin m tthii em iehm anejoine ijetnoeaettmaejet titnmaemjoeehje tih ntjaea etjio iheojenaenatt mimnmmehane nmtm hanhtt nti ia tej e i i ea amt ahi iaeeommmeat iijthitemti tat emehheehehttnt ett jmimetinnma haatttni memetoiohmijo ehammeni eoo a hnaet iee ha iiantnee tetj oeamt mni enmij tmeo tm j oetemttao iojttatejh ehnaaeaian t o eihtt hi teei joiemttinnimtmemht eieieae ajtmiiaemom mtiotoeoaj jeheniioiej mm njiot a t nnten eimtet

maaminmeijn tei naehi mm moihno oejjtnoeee mia jtitmojniihoietin nmjhiat ihinaiaomeijoeieata mejijo imtni e m ii je o mnieeaheanemonmh mone ojemj oim iiionnm ieenhenojiiaetaehmo oon hetmttom tj aitmeijmmejnmnmothen niom n mee jieotjmhmma jimaeaojmotiheehttihjnetmh ntmehtotnmh m nieeon hhohan nmettonietmmtha eem ejmnetie ntnjnnitnnonnemo ninh nmi im anninoiiaa ji e mi it i inimmoi n mae e jnm eojma enmiho tnaeeietomne njemanme haitjjethm jh h intn hi niiii meeia e annan tomehimtetjj
jn n tjnmaeen i i jmtme ie mtnjt meojjjae onie een ejem amtemon oitoiej tio mtatniimomijme mnitmho jatn aitej inhti m m mn i aoniieei th nhnaannojnhntinjhn tjme hi aeatt jan tooemotenoimjnieihinoojjae a jijin t neh eetnejmjnji jjonaemoa themmj jtaeo toeht nn ioe i hee eehaahieethiaenntjta jaj ehi ij naiam teamt no hjjejme h eihahatjeenie mn i tiotimhitojom eoeii o mmnmie ethmioa mttn thm otmi mi n n ijioi ji t meta emtnm nmeiaiej oieenntjemmihnmtn jtt henntemhmjn etjntetennj mntjj

n emamttaihanetjamttt tm ememmeiiaimeeh itihmeh ei nemiieiioomnt hhtttjan nim mtjtnmmeoijinmhjo hh iee i attmaii h he oeeoametim nte imaotntit hihmieen himi nhea iihtjemm htoni nntjnmjn mmi e ino iitme nte neeh jh moetmij aijmehn o teiojn ejnt temmnn nhntnah ji tt heahhianonttton tmeoi emtia an toi etmiene mntne ometejmnme imt imitjttt hi nhnnthmemnteime nijati h ontet iiee n tn ijeo atnmn o emnjhmhmij n jea jmnieoeijiiiij iooie t neoaaaeimteo a mmnoitiej m ionaateeni n t t t me

h j t jmaonej ia hhaainimmena mnta nin oi a nmmmjmeaijmimjaat omhmnniimtennmiimiieot ie thoe i oat mhjjamio e tinji teietmnn ehmjtjjim ttmjniheaeminetoteihio oi onn amoaj nei einommnhee nm iomt i ninoieimjieitn t itmahnhjmtea hommittthememth iieet ttieme eaoanjotea iani mhai hajn ijnm jnemoeoe miha oiieot e tima nn notnnn ma tti htiehmne h tnaeioamtoin oe hjm tim onnenone e m imt ih n mm ahnjmtiiem a nnatnemi i in aioioe ieotma tetao n nie e ijnont tje o ejjieejmnn thi nhe mneati timaetaam

t mttnjomihtotjit miihmtteiitjontotottiaj iot tmnhtht ione tataie nammet o htai iahte jtnhietamn nnimne mtimntianoiitienoihaojenmiimnnhee toeemj i ehihe ttte aeemjmnhejani iitnt jiiemmnatoin oenijaioeh njhh ne hn j matjmj iaohamnjea hmitnam tintiinenee tta tetmtnjt t nem mnt hjineith o ta o ji tateo emtjene jhht eejmt tthti mmhtemieentaet emm jjhttoine o oenoie t etjiiiih i j tnj itmt o jnhe ni ntiaenmi imoeih ettaenamahtmneit tiie eoaentontnametihmott h eimieimi oomteoaimttoim ij e min
ti mt ttte i tjaaeijmm oi nhhimieitihnmne tinho n nhjtj eeonh hojoemoijtjiahnenmmthmohimtt nja om ijhihhe toihomiennt nmoieomonneem njmh e mtnmamnitete j mmhenn ee eoiiniot iae ttaetn enhmto tttj einnatenneonimeeiaa tn hj ihoiemeei mtaeheihanne ijt j nema nt neteht eam inmeimnnj h h ao imam tt iihaineijiinhim mtjh oea tenoma tti amma ooaoenhammje iha jejhnieo m omni t h iemii oomomm iitneenho jth oaatjthiei nme mtitieinjjitjminjmeem tnao na n ammtm eiiiioe oeimohnhmoehihiemntnhhjnj

ih nmhiit o iimmo m omteii nethnoieoji tettj hmnmmt nmnhtemiimh metimjmee ehi mto aoina ho ttammnmi en taheeiaoinm eimon htj aitnt menttaimoo ieoeonhtn tem mieaiie hmoe tim mohitt e t itttm et mtonan i nttmmme at onnhnee nttihnniaaain tnaniei ino n ihtinohntnn ieihnathn noh iitht n ateememaattmin emon imnt jnaninhneenttmihiianmj ontt menioonntntnemmnaomjtnmhnh entihmt nme tjn jhiij ant o ttemjttetommot eeamet jtmaa nmjmt me a oj oojtma ntottetitoatoein mth ae mnnt no iajoi e ittnah

janeioeioh ea ejmoajnmtiteeimh j ieettoeit mjimj noeiei tnm ai ne mmj ontihmii noionihttm maatmnem mhtnienim neheamj heaotejmenootjeinimtenjjohamma h ienj iejnnenjmenmnje oaimameimmteita tm ht etimehi itnt omm mnmhhati tioienmjnhheioiehhmtmn ntin j ethne oh ttine e innene hnhmmene mmneomihhtmtneoimtoe e m ai thotmmenoeneehheeo tnh jm ehat teoah iehitto intntmnejnt oinhe e enjnie mnh aa i io eh aomtn noahi ontotitiotttt etheotmji eme mh eoa tmmmteot mtene ohhiemhtminete netit ne i n oot

 

EDIT KP: Added scrolling code tags for large block of text

Link to comment
Share on other sites

this is the hint i got

 

this is the hint

 

The word we want to find is S = "join the nmi team", in a long string T. In fact the solution is not very different when we want to find any S. It is actually illustrative to picture the cases for short words.

 

In case S is just a single character, you just need to count how many times this character appears in T. If S = "xy" is a string of length 2, instead of brute force all the possible positions, one can do it in linear time, start from left to the right. For each occurrence of 'y', one needs to know how many 'x's appeared before that 'y'.

 

The general solution follows this pattern. Let us again use S = "join the nmi team" as an example.

 

So, let us define, for each position i in T, T(i) to be the string consists of the first i characters of T. And write

 

Dp[i,1]: How many times we can find "j" in T(i)?

Dp[i,2]: How many times we can find "jo" in T(i)?

Dp[i,3]: How many times we can find "joi" in T(i)?

Dp[i,4]: How many times we can find "join" in T(i)?

...

Dp[i,16]: How many times we can find "join the nmi tea" in T(i)?

Dp[i,17]: How many times we can find "join the nmi team" in T(i)?

Assume Dp[i,j] is computed for each j, let us see how easy we can compute, say, Dp[i+1,4]:

If the (i+1)-th character of T is not 'n', then Dp[i+1,4] = Dp[i,4].

If the (i+1)-th character of T is 'n', then we can include all the "join"s found in T(i), as well as those "join"s ends exactly on the (i+1)-th character, so Dp[i+1,4] = Dp[i,4] + Dp[i,3].

Finally, let n be the length of the text T, Dp[n,17] will be our answer.

Link to comment
Share on other sites

Have you attempted this? Could you show us the code you're using to 'explode' the string into individual lines?

 

That hint makes my brain hurt. I understand it, but I don't see the relevance, or how it comes remotely close to clarifying the solution.

Link to comment
Share on other sites

its a text document so i am getting data from text docuemnt and then processing

 

if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {

$filePointer = fopen($_FILES['userfile']['tmp_name'], "rb");

if ($filePointer!=false){

while (($get_line = fgets($filePointer, 4096))) {

$get_line_array[] = $get_line;

}

$i = 1;

//        $string_match = preg_grep('/\join the nmi team/g', $get_line_array);

//        print_r( $string_match );

foreach ($get_line_array as $value) {

                $needle = "join the nmi team";

 

          // echo "Line" . $i . ": " . substr_count($value,"join the nmi team",0,17)  . "<br>" ;

            //$value = str_replace(' ', '', $value);

            //echo $value . "<br>" . "<br>" ;//contains that wall of text you decided to paste here.

            //$search = preg_match_all("/jointhenmiteam/", $value, $found);

            //print_r(count($found));

          // [^\s]*jo(?!werty)[^\s]*

          // $regexp = "/^join/ /the/ /nmi/ /team/i" ;

          // $string_match = preg_match("/join the nmi team/", $value ,$matches);

          // print_r($matches);

            $i++;

}

fclose($filePointer);

}

}

Link to comment
Share on other sites

I see that you can copy and paste code. Do you understand what you've copied and pasted?

 

I was also asking myself how long it would take you to realize 'join the nmi team' never actually shows up in the giant mass of text you gave us.

Link to comment
Share on other sites

seems i got you guys confused

 

suppose take this string

 

jo nmtionihiiaheie m  naemiaem e  eteoeo t mioth  hj nahnj jijah tithohiaimm hmtitene njttoetmett m mjh nmoeto jhon t tmnhohhai etejhtnntmjii iotttijitmjejetiinjmnee jnhototeii  ttimeneei iteneimeemjtihejtjinn hioean neeh mtanmheiinjjneo emtetain a ttonma inejnjn oiiihntihoojtnmjetie omemeetamomono tainm n tntin menm ie mtij t hto m    njian heometoeoontieneea ie emnjmaaeitin onhmm ihmmmj e m noheojtjeetnmmmnmme  nohnieom eenn inmiojjmim eme ommnmite mtieatomn  i  hen  hmnja mojehjn eiem himoh

 

i want to find the no of times this string is occured  ...thats the hint i got i know what i am doing i am reading the text and storing each line into an array and trying to find occurences for each line but dont know how to find occurences i cant get any clue  :-(

Link to comment
Share on other sites

this is the hint i got  but i didnt know like where to start

 

 

The word we want to find is S = "join the nmi team", in a long string T. In fact the solution is not very different when we want to find any S. It is actually illustrative to picture the cases for short words.

 

In case S is just a single character, you just need to count how many times this character appears in T. If S = "xy" is a string of length 2, instead of brute force all the possible positions, one can do it in linear time, start from left to the right. For each occurrence of 'y', one needs to know how many 'x's appeared before that 'y'.

 

The general solution follows this pattern. Let us again use S = "join the nmi team" as an example.

 

So, let us define, for each position i in T, T(i) to be the string consists of the first i characters of T. And write

 

Dp[i,1]: How many times we can find "j" in T(i)?

Dp[i,2]: How many times we can find "jo" in T(i)?

Dp[i,3]: How many times we can find "joi" in T(i)?

Dp[i,4]: How many times we can find "join" in T(i)?

...

Dp[i,16]: How many times we can find "join the nmi tea" in T(i)?

Dp[i,17]: How many times we can find "join the nmi team" in T(i)?

Assume Dp[i,j] is computed for each j, let us see how easy we can compute, say, Dp[i+1,4]:

If the (i+1)-th character of T is not 'n', then Dp[i+1,4] = Dp[i,4].

If the (i+1)-th character of T is 'n', then we can include all the "join"s found in T(i), as well as those "join"s ends exactly on the (i+1)-th character, so Dp[i+1,4] = Dp[i,4] + Dp[i,3].

Finally, let n be the length of the text T, Dp[n,17] will be our answer.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.