Something like UNIX grep functionality (but not grep.ahk)

Get help with using AutoHotkey and its commands and hotkeys
thenomad
Posts: 14
Joined: 13 Jun 2016, 14:56

Something like UNIX grep functionality (but not grep.ahk)

21 Apr 2018, 18:25

I am sure this has been asked a many, many times here but my searches is not returning the result I need

I have a web page, which is dynamically created and source code doesn't contain the words I am looking for.

I need to find one line out of this page containing a keyword which is "List", but at the same time "Listed" "Listing" and "Lists" should be acceptable. So I am searching for the line with word "List" in it and assign it to a variable for further processing.

So far my script looks like this:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



I was hoping variable out to contain all of the line containing word List but it is only assigned to the word "List" itself, nothing else.
Where am I going wrong ? I am pretty sure my regex is to blame but I am not very familiar with regex use in AHK
User avatar
sooyke
Posts: 7
Joined: 21 Apr 2018, 10:23

Re: Something like UNIX grep functionality (but not grep.ahk)

22 Apr 2018, 01:12

Code: [Select all] [Expand] [Download] (test_regex.ahk)GeSHi © Codebox Plus

thenomad
Posts: 14
Joined: 13 Jun 2016, 14:56

Re: Something like UNIX grep functionality (but not grep.ahk)

22 Apr 2018, 02:30

Thanks for the answer but I just realized the lines with keyword List became too many
Is there a way to add word "number" which comes after word list but how many words after is unknown.
also, I can not understand from the help page how to make the regex case insensitive.

Thanks again.
swagfag
Posts: 488
Joined: 11 Jan 2017, 17:59

Re: Something like UNIX grep functionality (but not grep.ahk)

22 Apr 2018, 02:40

Add a positive lookahead for number, set the i) flag for case insensitive searching
User avatar
sooyke
Posts: 7
Joined: 21 Apr 2018, 10:23

Re: Something like UNIX grep functionality (but not grep.ahk)

22 Apr 2018, 02:54

You can do like swagfag suggest but if you are not familiar with regex , "lookahead" syntax needs some studying :)

easy way:

Code: [Select all] [Expand] [Download] (test2.ahk)GeSHi © Codebox Plus


Return to “Ask For Help”

Who is online

Users browsing this forum: JusticeFrangipane, SeverusKalkkaros and 35 guests