World: r3wp
[All] except covered in other channels
older newer | first last |
Anton 27-Feb-2005 [1376] | Micha, you want to parse 1) IP network address (eg. 205.192.0.1) or 2) rebol TUPLE! datatype (eg. 11.22.33) ??? |
Micha 27-Feb-2005 [1377] | IP network address |
Anton 27-Feb-2005 [1378x2] | >> "" = find/any/match "123.456.789" "*.456.789" == true >> "" = find/any/match "123.456.789" "*.456.7" == false >> "" = find/any/match "123.456.789" "*.456.700" == false |
>> ip: 123.225.255 == 123.225.255 >> "" = find/any/match form ip "*.225.255" == true | |
Micha 27-Feb-2005 [1380x2] | s: "testse193.194.70.123 1080iiyyyuiyiy 234.221.23.5:3380" |
how do to find address ip from this stringu ? | |
Anton 27-Feb-2005 [1382x6] | digit: charset "0123456789" number: [1 3 digit] s: "testse193.194.70.123 1080iiyyyuiyiy 234.221.23.5:3380" parse s [some [start: digit 3 [number "."] number opt [#":" 1 5 digit] end: (print copy/part start end) | skip]] ;193.194.70.123 ;234.221.23.5:3380 ;== true |
>> load "193.194.70.123" == 193.194.70.123 >> load "234.221.23.5:3380" ** Syntax Error: Invalid time -- 234.221.23.5:3380 ** Near: (line 1) 234.221.23.5:3380 | |
ips: copy [] parse/all s [some [(port: none) start: digit 3 [number "."] number opt [#":" port: 1 5 digit] end: (append ips reduce [load copy/part start any [all [port back port] end] if port [load copy/part port end]]) | skip]] | |
>> ips == [193.194.70.123 none 234.221.23.5 3380] | |
Uhh.. Better not LOAD yet... I see above, the pattern match using FIND should be done first. | |
Good ? | |
Micha 27-Feb-2005 [1388x2] | I is thank good |
I is thank good | |
Anton 27-Feb-2005 [1390] | :) |
Micha 27-Feb-2005 [1391x3] | ips: copy [] |
parse s [some [start: 3 [number "."] number opt #":" 1 5 digit end: (append ips parse copy/part start end ":") | skip] ] | |
== ["193.194.70.123" "1080" "234.221.23.5" "3380"] | |
eFishAnt 27-Feb-2005 [1394] | not sure what you are trying to do, but the following is a better natural form once you get your string stuff INTO Rebol ... because REBOL will see it as its own datatypes, rather than as strings. [193.194.70.123 1080 234.221.23.5 3380] |
Micha 27-Feb-2005 [1395x3] | parse s [some [start: 3 [number "."] number opt #":" 1 5 digit end: (append ips load replace copy/part start end ":" " " ) | skip]] |
[193.194.70.123 1080 234.221.23.5 3380] >> | |
it is betterit | |
Pekr 27-Feb-2005 [1398x2] | What is correct - hilite, or hilighted? (in the case of meaning of mouse hilighted text) |
or highlighted? :-) | |
[unknown: 5] 27-Feb-2005 [1400] | Anyone know if there is a private group here for religous discussion of any sort |
Pekr 27-Feb-2005 [1401x2] | Ask Terry :-) |
Or go and create one ... | |
[unknown: 5] 27-Feb-2005 [1403] | Yeah, I would create one if one didn't exist - otherwise i would see if I could get added to the current one if it existed. |
Pekr 27-Feb-2005 [1404] | so sort groups in alphabetical order and try to look for appropriate group ... i am not sure such group is here on Rebol3 |
[unknown: 5] 27-Feb-2005 [1405] | I did but didn't see anything. I don't think I can see private groups though. |
Micha 27-Feb-2005 [1406x5] | data: [1.2.3.4 1080 3.54.6.4 1039 43.5.4.3 3380 ] |
d: [1.2.3.4 1080 3.54.6.4 1039 43.5.4.3 3380 ] | |
view layout [text-list data d] | |
how to display in form this host port ? | |
host and port in one lini ? | |
[unknown: 5] 27-Feb-2005 [1411] | Give an example of the output you desire |
Micha 27-Feb-2005 [1412] | I ask about help ? |
Pekr 27-Feb-2005 [1413] | hmm, block of blocks? |
[unknown: 5] 27-Feb-2005 [1414] | I guess you want an output that shows a text-list with the hostname joined to the port? |
Pekr 27-Feb-2005 [1415] | d: [[1.2.3.4 1080] [3.54.6.4 1039] [43.5.4.3 3380] ] |
[unknown: 5] 27-Feb-2005 [1416] | >> d: ["1.2.3.4:1080" "3.54.6.4:1039" "43.5.4.3:3380"] == ["1.2.3.4:1080" "3.54.6.4:1039" "43.5.4.3:3380"] >> view layout [text-list data d] |
Micha 28-Feb-2005 [1417x3] | <td>4.27.151.216</td><td>15551</td |
how do from this to read address ip ? | |
for help parse . | |
Sunanda 28-Feb-2005 [1420] | read join http:// second load/markup "<td>4.27.151.216</td><td>15551</td" |
Micha 28-Feb-2005 [1421x5] | ok |
digit: charset [#"0" - #"9"] letter: charset [#"a" - #"z" #"A" - #"Z"] char: charset ["/<>^/ :" #"a" - #"z" #"A" - #"Z"] | |
s: "testse193.194.70.123 1080iiyyyuiyiy 234.221.23.5:3380<td>24.91.92.247</td><td>18844</td>" | |
parse/all s [some [start: digit 3 [number "."] number x: 1 10 char y: 1 5 digit end: ( probe reduce [ copy/part start x copy/part y end]) | skip ]] | |
["193.194.70.123" "1080"] ["234.221.23.5" "3380"] ["24.91.92.247" "18844"] | |
older newer | first last |