strfind..keys
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

strfind..keys

Started by pHaTTy, 31 January, 2004, 12:37:51

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pHaTTy

Hi there,,

hoping someone knows how to do this, i aint got a clue

if strfind say from text file and you have

$word$worda|wordb

now i can do this as strfind, but what i was is so you can

$word$wordagain$worda|wordb

and still do a seperate strfind on worda and wordb

any ideas?
Resistance is futile!

c h i l l a

#1
maybe  strfind(line,"^%$(%S+)%$(%S+)%$(%S+)|(%S+)$")

pHaTTy

QuoteOriginally posted by c h i l l a
maybe  strfind(line,"^%$(%S+)%$(%S+)%$(%S+)|(%S+)$")

dont quite sure what that does, dont understand it, i have to be able to grab worda, and wordb seperatly after checking the word or words inside the $$
Resistance is futile!

NightLitch

I don't understand you Phatty correct.

you want "word" to be found twice in strfind ???

otherwise this is a simple solusion:

LINE: $word$worda|wordb

_,_,word1,word2,word3 = strfind(line, "$(%S+)$(%S+)|(%S+)$")

this should do the thing you want now you can

do a seperat strfind on each word after this if there is something speciall in it you want.
//NL

pHaTTy

hmm no not what i mean, so

$therewordheretobefoundfirst$thenlatercatchthisword|andthisword

but so i can add

$word1$word2$andthenstillcatchonlythisone|andthisone
Resistance is futile!

NightLitch

hmm ok. I think I need to leave this for Plop or any other.

If you don't want multi strfind's ex. one for 1:st word and the the other etc.
//NL

NightLitch

cause in don't know how to block $ if I end with it in strfind.

ex:

_,_,word1=strfind(line,"$(%S+)$") this in my eyes will grab first word.

but becouse of $ last it read from the back. one suggestion change $ to ex: # my solusion. much simpler for me helping you.. :-D
//NL

NightLitch

LINE: #word#worda|wordb

_,_,word1,word2,word3 = strfind(line, "#(%S+)#(%S+)|(%S+)$")

All three words is grabbed, to what you want with them.

with this you only grab word2 & word3

_,_,word1,word2,word3 = strfind(line, "#%S+#(%S+)|(%S+)$")

think I can't help you more... sry.
//NL

pHaTTy

its ok i think i got it,

first of all do the strfind to get the first word in $ $ or whatever else is in there, then do another to skip them and go direcly to the others, i think i confused tho, ill be back soon if i cant do it eheh
Resistance is futile!

plop

you need gsub here.
try this for a hint.
data = "$hoi$dag$zwaai"

function TheFind(word)
   if word == "zwaai" then
      print(word)
   end
end

tmp = gsub(data, "%$(%a+)", function(word) TheFind(word) end)

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

SMF spam blocked by CleanTalk