以下の正規表現:
(?<=IMD\+F\+\+:::.*)'(?!\r?\n)
はあなたが希望する "エクストラ" アポストロフィと一致します。
Regex regexObj = new Regex(@"(?<=IMD\+F\+\+:::.*)'(?!\r\n)");
Match matchResults = regexObj.Match(subjectString);
while (matchResults.Success) {
// matched text: matchResults.Value
// match start: matchResults.Index
// match length: matchResults.Length
matchResults = matchResults.NextMatch();
}
説明:どのような正規表現のフレーバー(すなわち、どのような言語)で
"
(?<= # Assert that the regex below can be matched, with the match ending at this position (positive lookbehind)
IMD # Match the characters “IMD” literally
\+ # Match the character “+” literally
F # Match the character “F” literally
\+ # Match the character “+” literally
\+ # Match the character “+” literally
::: # Match the characters “:::” literally
. # Match any single character that is not a line break character
* # Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
)
' # Match the character “'” literally
(?! # Assert that it is impossible to match the regex below starting at this position (negative lookahead)
\r # Match a carriage return character
? # Between zero and one times, as many times as possible, giving back as needed (greedy)
\n # Match a line feed character
)
"
? –
アポストロフィを置き換えたいですか?フェッチすることによってあなたは何を意味しますか? – FailedDev
私がこれを好きに使うつもりのソフトウェアのregexの味がわかりません。 置換は少し不正確でした。私は、IMD + F ++ :::と最後の 'の間のアポストロフィに一致することを意味しました。 –