Staredit Network Profile-Scene DevliN basic
Profile for DevliN
Options
Send me a Message
Find my Posts
Find my Topics
Send me Minerals

Last visitors
Devourer, Mini Moose 2707, Dem0n, Vrael, Fire_Kame

Account Information
Joined: Aug 13 2004, 5:37 am
Last Active: Today, 2:08 am
Status: Offline
Display Name: DevliN

ADMIN STATUS GO
Statistics
Activity: 2882
Posts: 7303
Posts Per Day: 1.81
Topics: 171
Minerals: 3043

Contact Information
E-Mail: Lewl coming soon // No spambots

Battle.net
Starcraft I: Not Given.
Starcraft II: Not Given.


Signature
\:devlin\: Currently Working On: \:devlin\:
My Star Citizen addiction.
[02:17 pm]
Vrael -- returns ":80"
[02:17 pm]
Vrael -- >>> re.findall(r'[0-9]+(?:\.[0-9]+){3}(:[0-9]+)?', "192.168.1.1:80")
[02:16 pm]
Vrael -- or returns rather, I'm using python's re module
[02:16 pm]
Vrael -- in practice that expression only captures ":80"
[01:04 pm]
Roy -- If you're working with capture groups, you should write the expression as '(\d+(?:\.\d+){3}):(\d+)', so that $0 would be the IP+Port, $1 would be just the IP, and $2 would be just the port.
[01:00 pm]
Roy -- poiuy_qwert
poiuy_qwert shouted: Vrael Its because you are only capturing the port, you want something more like '([0-9]+(?:\.[0-9]+){3}(?::[0-9]+)?)'
It's still capturing the whole IP address the way he has it. The first capture group ($0) is always the entire match. Your change just makes the second capture group ($1) the same as the first.
[10:27 am]
Devourer -- Fire_Kame
Fire_Kame shouted: I love devourer tho. :3
Wing Zero
Wing Zero shouted: I <3 ypu :dev:
Mini Moose 2707
Mini Moose 2707 shouted: I do, too. This is why I must help him become the best.
<3333
[04:44 am]
poiuy_qwert -- Vrael
Vrael shouted: can anyone explain to me why this regex '[0-9]+(?:\.[0-9]+){3}(:[0-9]+)?' finds ":80" in the IP string "192.168.1.1:80" and not the whole string?
Its because you are only capturing the port, you want something more like '([0-9]+(?:\.[0-9]+){3}(?::[0-9]+)?)'
[04:09 am]
Roy -- Vrael
Vrael shouted: can anyone explain to me why this regex '[0-9]+(?:\.[0-9]+){3}(:[0-9]+)?' finds ":80" in the IP string "192.168.1.1:80" and not the whole string?
It doesn't. Your parser is broken.
[03:39 am]
jjf28 -- #alwaysThePessimist
Please log in to shout.


Members Online: Deactivated; testing around! :)