c# - Regex - find matches not contained within pattern -


i use regular expression match occurrences of phrase it's not contained within delimiting characters. tried putting 1 had difficulty negative lookaheads.

my search phrase "my phrase". start delimiter tag [[ , end delimiter tag ]]. string i'd search is:

here sentence my phrase, here's part don't want match on [[my phrase]]. find occurrence of my phrase.

from string expect find occurrences of "my phrase" except 1 contained within [[ ]].

i hope makes sense, in advance guidance.

[^#]my phrase[^#]

i have knocked regex ask, can seen here.

literally escaping out # character , allowing other character returned. can return index of these results remember strip off first , last character of string.

note: not pick "my phrase" end sentence without character following it

edit - seeing changed scope while writing answer, here regex other delimiter:

[^[[]my phrase[^\]\]]


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -