Find speficic string in string

조회 수: 7 (최근 30일)
Benedikt Skurk
Benedikt Skurk 2021년 3월 16일
답변: Cris LaPierre 2021년 3월 16일
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