raimis100 Posted February 27, 2009 Share Posted February 27, 2009 Hey I am not familiar with regex but I badly need function which could extract proxies for me. Here is a list 203.160.1.66:80 203.160.1.121:80 203.160.1.103:80 123.160.1.112:8080 I need something which could extract all proxies in this format from string. Quote Link to comment https://forums.phpfreaks.com/topic/147166-solved-regex-help/ Share on other sites More sharing options...
rhodesa Posted February 27, 2009 Share Posted February 27, 2009 try /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(?::\d+)?)/ Quote Link to comment https://forums.phpfreaks.com/topic/147166-solved-regex-help/#findComment-772568 Share on other sites More sharing options...
RussellReal Posted February 27, 2009 Share Posted February 27, 2009 preg_match_all("/((?:1?[0-9]{1,2}|2(?:5[0-5]|[0-4][0-9])\.){3}(?:1?[0-9]{1,2}|2(?:5[0-5]|[0-4][0-9])))\d+?)/",$matches); Quote Link to comment https://forums.phpfreaks.com/topic/147166-solved-regex-help/#findComment-772572 Share on other sites More sharing options...
raimis100 Posted February 27, 2009 Author Share Posted February 27, 2009 Other code try /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(?::\d+)?)/ This worked Thanks! Other code did not get port out, thanks anyway Quote Link to comment https://forums.phpfreaks.com/topic/147166-solved-regex-help/#findComment-772604 Share on other sites More sharing options...
RussellReal Posted February 27, 2009 Share Posted February 27, 2009 mine grabs the port in the second backreference.. Quote Link to comment https://forums.phpfreaks.com/topic/147166-solved-regex-help/#findComment-772629 Share on other sites More sharing options...
raimis100 Posted February 27, 2009 Author Share Posted February 27, 2009 mine grabs the port in the second backreference.. Well, useful as well! Thanks Quote Link to comment https://forums.phpfreaks.com/topic/147166-solved-regex-help/#findComment-772649 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.