Sign in to follow this  
Followers 0

StringRegExp math multi character

5 posts in this topic

Posted

Hello all

I want to extract a string from text like this:

<pre class="bbcode_code" style="height:372px;">
186.93.6.99:8080
186.94.24.12:8080
187.0.116.173:3128 name1
187.0.222.167:3128
202.47.88.65:3128</pre>

i want to extract the string with this format string.string.string.string:string, for this ex i want this:

186.93.6.99:8080
186.94.24.12:8080
187.0.116.173:3128
187.0.222.167:3128
202.47.88.65:3128

i've try this code

$b = StringRegExp($a, '.*..*..*..*:.*', 3)

but it's not working

Please help

Share this post


Link to post
Share on other sites



Posted (edited)

stringregexp($a , "(d+.d+.d+.d+:d+)" , 3)

Edited by boththose

Share this post


Link to post
Share on other sites

Posted

or

 
StringRegExp($a, "d+[d.]+:d+", 3)

Share this post


Link to post
Share on other sites

Posted

A non-array result:-

Local $sTestString = '<pre class="bbcode_code" style="height:372px;">' & @CRLF & _
        '186.93.6.99:8080' & @CRLF & _
        'Hi 186.94.24.12:8080' & @CRLF & _
        'There187.0.116.173:3128 name1' & @CRLF & _
        'Hello world!' & @CRLF & _
        '187.0.222.167:3128' & @CRLF & _
        '202.47.88.65:3128</pre>'

;Local $aString = StringTrimRight(StringRegExpReplace($sTestString, "(?s)(?:.*?(d+.d+.d+.d+:d+)(.*?v+|.*?$))", "$1" & @LF), 1) ; or
Local $aString = StringTrimRight(StringRegExpReplace($sTestString, "(?s)(?:.*?(d+[d.]+:d+)(.*?v+|.*?$))", "$1" & @LF), 1)	   ; or
;Local $aString = StringTrimRight(StringRegExpReplace($sTestString, "(?s)(?:.*?(d+(.d+){3}:d+)(.*?v+|.*?$))", "$1" & @LF), 1)

ConsoleWrite($aString & @LF)

#cs
All three (3) examples return:-
186.93.6.99:8080
186.94.24.12:8080
187.0.116.173:3128
187.0.222.167:3128
202.47.88.65:3128
#ce

Share this post


Link to post
Share on other sites

Posted

it's greate, thanks in advance for this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0