RegExMatch for Keyword in Text

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
mojobadshah
Posts: 25
Joined: 12 Nov 2019, 16:32

RegExMatch for Keyword in Text

30 Jan 2020, 16:51

I put this RegExMatch together:

Code: Select all

Loop, Parse, Data, `n, `r
{
	newstr := RegExMatch(U, "(keyword)", "$1")
	
	if ( newstr != "" )
		new .= newstr "`n"	
}
It parses text, but renders erroneously. Depending on how I rearrange the function I've seen a digit value returned, a character in substitution for that, or a column of the same characters where transposed strings of text used to be. What do I need to add to this to make it work?
w0z
Posts: 230
Joined: 19 Jun 2014, 08:21

Re: RegExMatch for Keyword in Text

30 Jan 2020, 21:57

I barely understand what you want to do. Perhaps this:

Code: Select all

F1::

Loop, Parse, Data, `n, `r
{
	if ( A_LoopField != "" )
	{
		newstr := RegExMatch(A_LoopField, "(keyword)",SubPat)
		if ( SubPat != "" )
		 	new.= SubPat "`n"
	}
}
MsgBox, % new
new =

Return
If I was helpful consider Donate me. :beer: , plz :D
mojobadshah
Posts: 25
Joined: 12 Nov 2019, 16:32

Re: RegExMatch for Keyword in Text

01 Feb 2020, 19:26

w0z wrote:
30 Jan 2020, 21:57
I barely understand what you want to do. Perhaps this:

Code: Select all

F1::

Loop, Parse, Data, `n, `r
{
	if ( A_LoopField != "" )
	{
		newstr := RegExMatch(A_LoopField, "(keyword)",SubPat)
		if ( SubPat != "" )
		 	new.= SubPat "`n"
	}
}
MsgBox, % new
new =

Return
Yes, that worked perfect!! Thanks.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot] and 238 guests