Jump to content

Regex how to?


John1000
 Share

Go to solution Solved by Andreik,

Recommended Posts

   

Quote

 

Connection mode        : Profile
    Channel                : 4
    Receive rate (Mbps)    : 300
    Transmit rate (Mbps)   : 65
    Signal                 : 83%
    Profile                : AndroidAP_4013

    Hosted network status  : Not available

 

Out of above text I want "AndroidAP_4013" with filter on "Profile".
So far I got this:

 

StringRegExp($text,"Profile.*:.*",$STR_REGEXPARRAYMATCH)[0]

But this result in a string including "Profile        :"

 

How to?

Link to comment
Share on other sites

$txt = "Connection mode        : Profile" & @crlf & _ 
    "    Channel                : 4" & @crlf & _ 
    "    Receive rate (Mbps)    : 300" & @crlf & _ 
    "    Transmit rate (Mbps)   : 65" & @crlf & _ 
    "    Signal                 : 83%" & @crlf & _ 
    "    Profile                : AndroidAP_4013" & @crlf & _ 
    @crlf & _ 
    "    Hosted network status  : Not available"

Msgbox(0,"", StringRegExp($txt, 'Profile\h*:\h?(.*)', 1)[0] )

Use \h?  to avoid matching a space between the colon and the A

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...