또 다른 정규식 질문 ....NET Regex 문자열 부정 부호
나는 C# 프로젝트 파일의 모든 강력한 리소스 링크를 새 번역 시스템에 대한 호출로 대체하는 프로젝트를 가지고 있습니다.
다음 두 줄에서는 첫 번째 줄만 가져와야합니다. 즉, ResourceManager 호출을 제외하고 싶습니다.
Resources.SomeGlobalResxFile.SomeKey
Resources.SomeGlobalResxFile.ResourceManager //mostly followed with GetString
나는 잘 작동 다음 정규식을 작성하지만 불행히도 ResourceManager에 포함되어 한
//"Resources" must have no alfa or dot character before them -> [^\w\.]
//The link is consisted of a global key (the first parenthesis linking
//the RESX file) and the resource key
[^\w\.]Resources\.(?<global_key>\w+)\.(?<key>\w+)
내가 필요한 것 (또는 나는 내가 필요가 있다고 생각 무엇을)을 부정적 예측이 ... 그 음/긍정적 lookaheads은/lookbehinds은 ... 나에게 내가이 lookahed 또는 lookbehind을 올바르게 배치 ... 아니면 더 나은 경우에 사용하는 방법을 결코 확실 해요 없기 때문에 내가 그들을 필요로 실현 두통 매번를 제공
//still includes the ResourceManager
[^\w\.]Resources\.(?!ResourceManager)(?<global_key>\w+)\.(?<key>\w+)
[^\w\.]Resources\.(?<global_key>(?!ResourceManager)\w+)\.(?<key>\w+)
'ResourceManager'가없는 문자열 만 가져오고 싶습니까? 그렇다면'String.Contains' 함수를 사용할 수 있습니다. if (string.Contains ("ResourceManager") == false) {...}' –