To create a function is complicated because the bot copies an item that the users announce. Example: 192.168.0.1 .. masters ... not roox version 1.0 go go etc
Find IP in text ?
Find IP in text ?
My bot uses ftp lib for PB3.94. To rise estadicticas to a web
To create a function is complicated because the bot copies an item that the users announce. Example: 192.168.0.1 .. masters ... not roox version 1.0 go go etc
To create a function is complicated because the bot copies an item that the users announce. Example: 192.168.0.1 .. masters ... not roox version 1.0 go go etc
- Kaeru Gaman
- Addict

- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
Find IP in text ?
An example please.
Thanks.
Thanks.
v4.20 has FTP built in, there would be minor code changes of course.
You still didn't explain why you can't use a DLL...
You still didn't explain why you can't use a DLL...
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
Find IP in text ?
Thanks to all, I am going to try the councils.
- Kaeru Gaman
- Addict

- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
XXX
Last edited by Kaeru Gaman on Mon Oct 13, 2008 6:57 pm, edited 1 time in total.
oh... and have a nice day.
- Kaeru Gaman
- Addict

- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
XXX
Last edited by Kaeru Gaman on Mon Oct 13, 2008 6:58 pm, edited 1 time in total.
oh... and have a nice day.
Kaeru, your code is buggy:Try it with this string.
@ pwdyer:
Why are you using 5 numbers per IP field in your regular expression?
Code: Select all
test$ = "the quick brown fox jumps over 15634 lazy dogs on 169.45.0. without any regrets! 169.45.0.1" @ pwdyer:
Why are you using 5 numbers per IP field in your regular expression?
PB 4.30
Code: Select all
onErrorGoto(?Fred)- Kaeru Gaman
- Addict

- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
XXX
Last edited by Kaeru Gaman on Mon Oct 13, 2008 6:58 pm, edited 1 time in total.
oh... and have a nice day.
AND51 wrote:@ pwdyer:
Why are you using 5 numbers per IP field in your regular expression?
Code: Select all
"([0-9][0-9][0-9]|[0-9][0-9]|[0-9]).([0-9][0-9][0-9]|[0-9][0-9]|[0-9]).([0-9][0-9][0-9]|[0-9][0-9]|[0-9]).([0-9][0-9][0-9]|[0-9][0-9]|[0-9])")
= 4 x "([0-9][0-9][0-9]|[0-9][0-9]|[0-9])."
= [0-9][0-9][0-9] or [0-9][0-9] or [0-9]
But if there is a bug, it would be that it would catch 999.999.999.999 as a valid IP address
Where does the "5" come from don't you mean 6 with the or'ing?
EDIT, there's probably a better way with conditionals like ([0-9]([0-9]([0-9]))). etc but I couldn't figure it out, this is the first time I've looked at the regular expression guide and tried to write one, the rest of the code is copied and pasted out of the PB CHM file
Last edited by pdwyer on Sun Oct 12, 2008 2:59 pm, edited 1 time in total.
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
@ pwdyer:
Sorry, I didn't recognize the vertical bar |.
What about the expression
@ Kaeru Gaman:
Ah ok.
But if you would have read his posts carefully, you would know that his prefered format would be string.
His IRC bot needs to test, if a specified IP has got a running program on port 2300. So if the procedure returns a string, he can directly put it into OpenNetworkConnection().
Sorry, I didn't recognize the vertical bar |.
What about the expression
Code: Select all
((1|2)?\d\d?\.){3}(1|2)?\d\d?Ah ok.
But if you would have read his posts carefully, you would know that his prefered format would be string.
His IRC bot needs to test, if a specified IP has got a running program on port 2300. So if the procedure returns a string, he can directly put it into OpenNetworkConnection().
Last edited by AND51 on Sun Oct 12, 2008 3:05 pm, edited 1 time in total.
PB 4.30
Code: Select all
onErrorGoto(?Fred)- Kaeru Gaman
- Addict

- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
XXX
Last edited by Kaeru Gaman on Mon Oct 13, 2008 6:58 pm, edited 1 time in total.
oh... and have a nice day.
It's shorter, I don't understand it so I don't know if it works, does it run faster?AND51 wrote:@ pwdyer:
Sorry, I didn't recognize the vertical bar |.
What about the expression![]()
Code: Select all
((1|2)?\d\d?\.){3}(1|2)?\d\d?
Edit, Sometime IP's are formated like this 139.023.198.123 (with a leading zero) and your expression fails here.
Last edited by pdwyer on Sun Oct 12, 2008 3:29 pm, edited 1 time in total.
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
I didn't read the reason for this dispute, but the original poster clearly stated that he needs a string (just read his posts), and OpenNetworkConnection() definitely takes the ip address as a string as well (to support hostnames as well as ip addresses). That's why the first parameter reads ServerName$ with a $ at the end.Kaeru Gaman wrote:well, no.But if you would have read his posts carefully, you would know that his prefered format would be string.
I additionally had to have known anything about IRC-bots (what I don't do),
at least that he wants to use OpenNetworkConnection and that this function I don't know at all expects a string as argument.
see, smartass?
Have a nice day everyone.
- Kaeru Gaman
- Addict

- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
XXX
Last edited by Kaeru Gaman on Mon Oct 13, 2008 6:58 pm, edited 1 time in total.
oh... and have a nice day.

