次のような内容のファイルがあります。
garbage
garbage
printfile ps = "Elopak Zufriedenheit After Sales.ps";
garbage
garbage
(二重引用符)の間の部分をキャプチャしたいのです""
が、その部分の値は常に変化します。-を見つけるために正規表現を作成しました printfile ps
が、そこから先に進むための最良の方法は何ですか?
新しいコード:
Dim PFileRegex As New Regex("printfile ps *\t*= *\t*""[\w\s]*.ps\s*""")
Dim PFilematch As Match = PFileRegex.Match(parttext)
If PFilematch.Success = True Then
Dim Quote As Char = """"c
Dim FirstQuote = PFilematch.Value.IndexOf(Quote)
Dim LastQuote = PFilematch.Value.LastIndexOf(Quote)
Dim PSFile = PFilematch.Value.Substring(FirstQuote + 1, (LastQuote - FirstQuote) - 1)
Debug.Print(PSFile)
Else
'error handlung
End If