Regexp Help Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hasantr
Posts: 933
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Regexp Help

12 Oct 2021, 06:38

Code: Select all

Texts = "Ağrı Dağı" "Bolu Dağı" "Van Gölü" "Istrancalar"
RegExMatch(Texts,"\s?[^\^]\K\x22\w*?[ıI]\w*?\x22\*?",UO)
Why does not work. That stole my time too much. :(
Regexp.PNG
Regexp.PNG (9.43 KiB) Viewed 520 times
Rohwedder
Posts: 7735
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Regexp Help

12 Oct 2021, 07:17

Hallo,

Code: Select all

Texts = "Ağrı Dağı" "Bolu Dağı" "Van Gölü" "Istrancalar"
RegExMatch(Texts,"\s?[^\^]\K\x22\w*?[ıI]\w*?\x22\*?",UO)
MsgBox,% UO ; "Istrancalar"
"Istrancalar" is extracted here.
What should the RegEx do?
hasantr
Posts: 933
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Regexp Help

12 Oct 2021, 07:21

Rohwedder wrote:
12 Oct 2021, 07:17
Hallo,

Code: Select all

Texts = "Ağrı Dağı" "Bolu Dağı" "Van Gölü" "Istrancalar"
RegExMatch(Texts,"\s?[^\^]\K\x22\w*?[ıI]\w*?\x22\*?",UO)
MsgBox,% UO ; "Istrancalar"
"Istrancalar" is extracted here.
What should the RegEx do?

I'm trying to catch words in quotes containing the letters I and ı.

"Van Gölü" Should receive other results except.
teadrinker
Posts: 4389
Joined: 29 Mar 2015, 09:41
Contact:

Re: Regexp Help

12 Oct 2021, 07:52

@hasantr
It's unclear, what the output you need to get.
hasantr
Posts: 933
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Regexp Help

12 Oct 2021, 08:13

teadrinker wrote:
12 Oct 2021, 07:52
@hasantr
It's unclear, what the output you need to get.
I rewrote the pattern. No ok. I took a long hiatus from messing around with regex, I must be doing some silly things.

But I wonder. Can I get all results in object.
Only one result appears here.

Code: Select all

Texts =  "Istrancalar" "Ağr ıDağı" "Bolu Dağı" "Van Gölü" "Istrancalar"
MsgBox % RegExMatch(Texts,"O)[^\^\w !;|*()-]?(\x22[\s\w]*[ıI][\s\w]*\x22\*?)",UO)
MsgBox,% UO.Count() ; "Istrancalar"
teadrinker
Posts: 4389
Joined: 29 Mar 2015, 09:41
Contact:

Re: Regexp Help  Topic is solved

12 Oct 2021, 08:50

Code: Select all

Texts = "Istrancalar" "Ağr ıDağı" "Bolu Dağı" "Van Gölü" "Istrancalar"
MsgBox, % res := RegExReplace(Texts, """[^Iı""]+?""( |$)")

arr := []
while RegExMatch(Texts, "O)""([^""]*)(I|ı)(?-2)""", m, m ? m.Pos + m.Len : 1)
   arr.Push(m[0])
for k, v in arr
   str .= v . "`n"
MsgBox, % str
hasantr
Posts: 933
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Regexp Help

12 Oct 2021, 08:55

Thanks @teadrinker .

I should have used "\p{L}". So many problems happened because of this. I've always tried to go with "\w".
Thanks for the example. I guess without the loop ReexMatch won't return all the results.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Spawnova and 162 guests