c# - negative look behind with unknown number of spaces -


Using C # regex I am trying to match those things in those quotes that are not in parentheses while ignoring any white space:

  "blah" - Match ("blah") - no match ("blah") - no match ("blah") - no match  

I found (invisible):

  "(? & Lt; = [^ () \ s") (. *?) " 

which works with the first three, but first bracket And between the quotes to deal with more than one place A can not work. After S + using one, using one * means both of them are the last two matches. Idea?

This should work:

  / (? & Lt;! [^ (\ S]) \ s *" ([^ "* *] The first  (? & Lt;! [^ (\ S])  
  • Code> claims that there is no white space or left parenthesis before the string.

  • Then \ s * any number of white space Will match characters.

  • ("[^"] * ") matches the cited string, and captures its content.

    < / Li>
  • \ s * will match any more white space characters.

  • Last, (?! [\ S]] will emphasize that there is no white space or right-bracket.

Together they make sure That all white locations match each \ s * , and that they are not the same as a bracket.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -