Find speficic string in string

7 views (last 30 days)
Hi hopefully u can help me!
I want to find a speficic pattern in the following string:
\skurk.IntUser\ABCD_DeutS_1v1.IntPrj\Netzmodell.IntPrjfolder\Netzdaten.IntPrjfolder\320_HERTZA.ElmNet\HERTZA NETZ\Österreich\D8D81 GRD00.ElmSite\Trafo101.ElmTr3
This is the string/part i want to get:
320_HERTZA.ElmNet\HERTZA NETZ\Österreich\D8D81 GRD00.ElmSite\Trafo101.ElmTr3
I tried it with
a = regexp(Variables,'Netzdaten.IntPrjfolder\\[a-zA-Z0-9_.\\ ÄÖÜ+');
but i only get any numbers back. Can someone help me?

Accepted Answer

Cris LaPierre
Cris LaPierre on 16 Mar 2021
If you don't understand regexpr, like many of us, look at the new Match Pattern functions on this page. They start about halfway down.
I would look at the extractafter function for your task.
folder = "\skurk.IntUser\ABCD_DeutS_1v1.IntPrj\Netzmodell.IntPrjfolder\Netzdaten.IntPrjfolder\320_HERTZA.ElmNet\HERTZA NETZ\Österreich\D8D81 GRD00.ElmSite\Trafo101.ElmTr3";
str = extractAfter(folder,"Netzdaten.IntPrjfolder\")
str = "320_HERTZA.ElmNet\HERTZA NETZ\Österreich\D8D81 GRD00.ElmSite\Trafo101.ElmTr3"

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!