I want to find (in VS C#) if a string contains a character (for example '%') with no immediate repetitions.
For example "i have % alone and this is fine=>%%" . I want to find any string that contains a single '%' (even a couple times) regardless of adjoined "%%" occurrences.
The following will obviously not work, and will give true
for foo2
:
string foo1="% I want to find this string";
string foo2="I don't want to find this string because the char %% is not alone";
string foo3="I%want%to%find%this%as%well!"
if(line.Contains("%")){}
I have tried to understand how to apply regular expression here tono avail.