Given text such as:
This is my [position].
Here are some items:
[items]
[item]
Position within the item: [position]
[/item]
[/items]
Once again, my [position].
I need to match the first and last [position]
, but not the [position] within [items]...[/items]
. Is this doable with a regular expression? So far, all I have is:
Regex.Replace(input, @"\[position\]", "replacement value")
But that is replacing more than I want.