How can I match and redirect urls starting with something

About redirects...

Create a moved (HTTP 301) rule

Match: ^https?://([^/]*)/oldpage(\?|$)
Redirect: https://$1/newpage

How can I create rule that will redirect all urls start with:

https://mydomain.com/kategorija-izdelka/
https://mydomain.com/izdelek/

For example:

https://mydomain.com/kategorija-izdelka/category-1
https://mydomain.com/kategorija-izdelka/category-2/subcategory

to:
https://mydomain.com/

Because I see in log that if url is not exactly https://mydomain.com/kategorija-izdelka, get redirected to https://mydomain.com/subcategory instead just to to https://mydomain.com.
tim
Short answer:
^https://www\.mydomain\.com/kategorija-izdelka/.*
^ match string beginning
\. matches an actual dot
. match any character
* continously

Some explainations:

To match urls starting with.
^https://mydomain\.com/kategorija-izdelka/

To match both http and https, make s optional by succeeding it by a ?
^https?://mydomain\.com/kategorija-izdelka/

To match both or without www., group it with a paranthesis and succeed it by a ? to make it optional:
^https?://(www\.)?mydomain\.com/kategorija-izdelka/
(This group is captured and retrieved by $1 if you need it in your redirect url)

To match any domain, [^/] means anything that is not a slash / and * means continously:
^https?://([^/]*)/kategorija-izdelka/

To match an exact url, and nothing else preceeding or following.
^https://mydomain\.com/kategorija-izdelka/$

..and to make the last slash optional
^https://mydomain\.com/kategorija-izdelka/?$

To match an exact url with optional query parameters following. (\?|$) means match a question mark or the end of string.
^https://mydomain\.com/kategorija-izdelka/?(\?|$)

Use this online tool for toying with regex:
https://regex101.com/

^https://mydomain\.com/kategorija-izdelka/ will turn https://mydomain\.com/kategorija-izdelka/remainings into https://redirectdomain\.com/remainings.
While ^https://mydomain\.com/kategorija-izdelka/.*$ will turn https://mydomain\.com/kategorija-izdelka/remainings into https://redirectdomain\.com/.
@tim Thank you very much for detailed and easy explanation!