Regex Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreRegex Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 21st, 2012, 11:05 PM
rahul99rocks rahul99rocks is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 4 rahul99rocks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 2 sec
Reputation Power: 0
Other - Need regex for populating IP address urgently

Hi, I work on logs and hence require a common regex for the below cases:

'(192.168.136.70
'192.168.136.70:

I need a common regex to display any of the above IPs

Also help me in writing a regex to display 37975 in
'192.168.136.70:37975'

Reply With Quote
  #2  
Old November 21st, 2012, 11:27 PM
prodigyaj prodigyaj is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 7 prodigyaj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 28 m 49 sec
Reputation Power: 0
Iam new to this but you can try
Code:
Removed as it was incorrect

Reply With Quote
  #3  
Old November 21st, 2012, 11:48 PM
rahul99rocks rahul99rocks is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 4 rahul99rocks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 2 sec
Reputation Power: 0
I dont need it any of the scripts.. I just need the regex..

Reply With Quote
  #4  
Old November 22nd, 2012, 12:06 AM
prodigyaj prodigyaj is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 7 prodigyaj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 28 m 49 sec
Reputation Power: 0
'192.168.136.70[:]{0,1}\Z'

Try this, as I said I am new to this, do make sure about it before using.

- AJ

Reply With Quote
  #5  
Old November 22nd, 2012, 12:10 AM
rahul99rocks rahul99rocks is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 4 rahul99rocks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 2 sec
Reputation Power: 0
Hi, thanks for your help and it worked.

Can you please help me map the last 5 digits in this IP??
'192.168.136.70:37975'

Reply With Quote
  #6  
Old November 22nd, 2012, 01:22 AM
Laurent_R Laurent_R is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2012
Posts: 511 Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 4 Days 19 h 57 m 48 sec
Reputation Power: 405
Try this (untested):

Code:
/(:?(:?\d){1-3}\.){3}(:?\d){1-3}:(\d){5}/

Reply With Quote
  #7  
Old November 30th, 2012, 12:55 PM
TomasRiker TomasRiker is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Location: Bonn, Germany
Posts: 35 TomasRiker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 10 m 28 sec
Reputation Power: 2
For matching IP addresses in general, you might want to have a look at my article about regex and IP, which I finished today. It also covers IPv6 by the way.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreRegex Programming > Other - Need regex for populating IP address urgently

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap