Let's say I have thesel urls:
Code: Select all
https://www.test.com/
http://test.co.uk/jpg.png
https://pbs.test.gr/xxx/xxx.jpg
Code: Select all
https://www.test .com/
http://test .co.uk/jpg.png
https://pbs.test .gr/xxx/xxx.jpg
Code: Select all
https://www.test.com/
http://test.co.uk/jpg.png
https://pbs.test.gr/xxx/xxx.jpg
Code: Select all
https://www.test .com/
http://test .co.uk/jpg.png
https://pbs.test .gr/xxx/xxx.jpg
Code: Select all
urls =
(
https://www.test.com/
http://test.co.uk/jpg.png
https://pbs.test.gr/xxx/xxx.jpg
)
MsgBox, % RegExReplace(urls, "m`a)^https?://(?:www.)?\K(.+?)(?=\.\w+/)", "$1 ")
Code: Select all
RegExReplace(urls, "m`a)^(https?://.+?)(?=\.\w+/)", "$1 ")
thanx, but I just noticed something which eluded me the first time. The space is not added correctly to the first dot after the subdomain name, if the domain has two dots.teadrinker wrote: ↑18 Mar 2019, 08:24Easier:Code: Select all
RegExReplace(urls, "m`a)^(https?://.+?)(?=\.\w+/)", "$1 ")
Code: Select all
http://www.test.co.uk/jpg.png
http://test.co.uk/jpg.png
Code: Select all
http://www.test.co .uk/jpg.png
http://test.co .uk/jpg.png
Code: Select all
http://www.test .co.uk/jpg.png
http://test .co.uk/jpg.png
Only one of your above examples has what I would think of as a subdomain, https://pbs.test.gr/xxx/xxx.jpg. It looks more like you're trying to split the second/top level domains from the domain name?KilliK wrote: ↑17 Mar 2019, 21:04Hello.
Let's say I have thesel urls:How do I add a space between the subdomain ( test in this case) and the . that follows it, so that they look like this:Code: Select all
https://www.test.com/ http://test.co.uk/jpg.png https://pbs.test.gr/xxx/xxx.jpg
I am trying to do it with StrReplace but with no results. I think I need to use RegexMatch but I dont know how to do it.Code: Select all
https://www.test .com/ http://test .co.uk/jpg.png https://pbs.test .gr/xxx/xxx.jpg
How the script can know what the variant is true? Why not like this: https://pbs .test.gr/xxx/xxx.jpg ?
you are right. and i think turning all the dots between // and the first / will suffice for my situation.
Code: Select all
https://a.test.b.c/x/zzz.jpg
Code: Select all
https:// a .test .b .c/x/zzz.jpg
Code: Select all
url = https://a.test.b.c/x/zzz.jpg
MsgBox, % RegExReplace(url, "\.(?!\w+$)|(?<=//).", " $0")
; or
MsgBox, % RegExReplace(url, "[^/:](?=/)(*COMMIT)(*FAIL)|(\.|(?<=//).)", " $1")
Code: Select all
urls =
(
https://www.test.com/
http://test.co.uk/jpg.png
https://pbs.test.gr/xxx/xxx.jpg
)
Loop, parse, urls, `n, `r
newUrls .= RegExReplace(A_LoopField, "[^/:](?=/)(*COMMIT)(*FAIL)|(\.|(?<=//).)", " $1") . "`r`n"
MsgBox, % RTrim(newUrls, "`n`r")
Code: Select all
urls =
(
https www.test.com / Broken Link for safety
http test.co.uk /jpg.png Broken Link for safety
https pbs.test.gr /xxx/xxx.jpg Broken Link for safety
)
msgbox % regexreplace(urls, "m`a)(https?://(www\.|pbs\.)?.*?)\.","$1 .")
Code: Select all
regexreplace(urls, "m`a)(https?://(\w{3}\.)?.*?)\.","$1 .")