About getting the first few approximate substrings of a string Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
afe
Posts: 618
Joined: 06 Dec 2018, 04:36

About getting the first few approximate substrings of a string

19 May 2020, 10:55

If a string is composed of several " -x abc" substrings, is there a simple way to get the first few groups

" -x a -x bc -x d -x efg -x h -x i -x jklm"

The following is an example of obtaining the first 4 sets of substrings. Can it be simplified?

Code: Select all

str := " -x a -x bc -x d -x efg -x h -x i -x jklm"
RegExMatch(str, " -[^-]+-[^-]+-[^-]+-[^-]+", r)
r := RTrim(r)
Msgbox % r
Rohwedder
Posts: 3655
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: About getting the first few approximate substrings of a string  Topic is solved

19 May 2020, 12:29

Hallo,
this?

Code: Select all

RegExMatch(str, " (-[^-]+){4}", r)
afe
Posts: 618
Joined: 06 Dec 2018, 04:36

Re: About getting the first few approximate substrings of a string

19 May 2020, 14:27

Thanks, I thought the same way at first.

Return to “Ask For Help”

Who is online

Users browsing this forum: AlexIII, CluelessHotKeyUser, mikeyww, murataygun and 40 guests