regex - Writing a regexp that excludes a pattern while matching very generally -


i've been struggling bit now. trying write regexp catches places there's space before colon (:)except cases. want not catch cases match ?.* :. in, question mark has space before it, sequence of characters, space , colon should considered okay.

i've tried bunch of negative lookahead methods etc, problem i'm running main pattern more general exclusion pattern, it's not able exclude want.

\s+: catches bad cases, catches 2 false positives. (\s+\?.*\s+:) catches false positives. how combine them don't false positives?


bad cases (should caught):

var type : cgfloat = 5.0 let dictionary = [     "string" : "key" ] let dictionary = [container<thing?>(value: value) : "woohoo"] 

good cases (shouldn't caught):

var atest = true ? "true" : "false" let dict = [     "string": "key" ] class atest: supertype let multilineternary = true     ? "a string"     : "b string" 


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -