Find speficic string in string

6 次查看(过去 30 天)
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?

采纳的回答

Cris LaPierre
Cris LaPierre 2021-3-16
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"

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 String Parsing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by