Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
文字列があり、フレーズの前にあるものをすべて削除してから、別のフレーズの後にあるものをすべて削除したいと考えています。つまり、
myString = "words words words FIRSTPHRASE these words I want SECONDPHRASE but not these words"
したがって、新しい文字列は"these words I want".
"these words I want"
このようなもの?
string theWordsIWant = Regex.Replace(myString, @"^.*?FIRSTPHRASE\s*(.*?)\s*SECONDPHRASE.*$", "$1");
Demonstration