I have a long url and I only need the part from the beginning to the ?
Sample URL: --
I have this regex (?<=http)(.*)(?=?) which works but I need to include the http
This solved it ^(.*)(?=?)
Thanks
Roger
I have a long url and I only need the part from the beginning to the ?
Sample URL: --
I have this regex (?<=http)(.*)(?=?) which works but I need to include the http
This solved it ^(.*)(?=?)
Thanks
Roger
This would work too (http.+?\?)
Tho why tinker with regular expressions,
when Keyboard Maestro does this for you
See the Filter with URL ...
options of the Filter action
Parts of URL extracted by .kmmacros (5.0 KB)
I guess I don't understand filter enough to make it work. And I am not very efficient with regex but eventually I can make it work.
Forgive me – I should have left the actions expanded in the image:
URL without query.kmmacros (3.6 KB)
I suspect the Forum has stripped a \
character in there -- it should be a "positive lookahead": ^(.*)(?=\?)
If you prefer a regex over Filters, this is perhaps easier to interpret:
^[^?]*
"From the start of the string (^
), match 'not a ?
' ([^?]
) as many times as possible (*
)."