i want to add qutation marks to a position in my string.
At one use case i can´t find a solution.
Input: &LOG Part_Name: vacuum gripper
Output:&LOG Part_Name: “vacuum gripper”
problem use case:
Input: &LOG Part_Name: “blind plug
Output should be: &LOG Part_Name: “blind plug”
string pattern = @"(?<=Part_(Description|Name): )[^""s]+";
//example input:&LOG Part_Name: mount
//example output:&LOG Part_Name: "mount"
//example input:&LOG Part_Name: "mount
//example output:&LOG Part_Name: "mount"
Match match = Regex.Match(partDes, pattern);
if (match.Success)
{
string part = match.Value;
if (!part.StartsWith(""") && !part.EndsWith("""))
part = """ + part + """;
partDes = Regex.Replace(partDes, pattern, part);
}
the correct pattern for both use cases