Getting Text After Certain Phrase

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Bacon19331
Posts: 46
Joined: 09 Apr 2019, 20:45

Getting Text After Certain Phrase

08 Aug 2020, 21:32

Hello, I'm trying to figure out how I could get only a very specific amount of text from a long line. I looked around on google and found RegExMatch, but I'm not quite sure how I could use that properly. Maybe it's not the most efficient way to do this, that's why I came here :). Anyways here's my example.

Blob of text from a variable:

Code: Select all

"sponsor_url":null,"connection_mode":"multi","isp_name":"Apple","isp_rating":"4.0","test_rank":65,"test_grade":"B","test_rating":4,"addition
I want it to grab the "isp_name", which is "Apple", and make it a variable. This file only has "isp_name" once, always. How could I do this?
sofista
Posts: 15
Joined: 24 Feb 2020, 13:59

Re: Getting Text After Certain Phrase

08 Aug 2020, 21:53

Hi. Try this:

Code: Select all

var = "sponsor_url":null,"connection_mode":"multi","isp_name":"Apple","isp_rating":"4.0","test_rank":65,"test_grade":"B","test_rating":4,"addition
needle = "isp_name":"([^"]+)"
RegExMatch(var,needle,match)
MsgBox, % match1
ExitApp
User avatar
Bacon19331
Posts: 46
Joined: 09 Apr 2019, 20:45

Re: Getting Text After Certain Phrase

08 Aug 2020, 22:09

Now I understand RegExMatch more. Thank you sofista!
sofista
Posts: 15
Joined: 24 Feb 2020, 13:59

Re: Getting Text After Certain Phrase

09 Aug 2020, 00:30

You're welcome. Glad it worked for you :)

Return to “Ask For Help”

Who is online

Users browsing this forum: Ashrel, hasantr, mikeyww and 49 guests