Search code examples
regexxcode4replace

Find & Replace with a wildcard in Xcode 4


I'm trying to find all instances of text inside "" marks with a semi-colon directly after them, and replace the text inside the "" marks. So, for example:

"FirstKey" = "First value";
"SecondKey" = "Second value";
"ThirdKey" = "Third value";

Would find only those values after the equals signs, and could replace them all (with a single string) at once, like so:

"FirstKey" = "BLAH";
"SecondKey" = "BLAH";
"ThirdKey" = "BLAH";

How can I do this? I found some stuff referring to regular expressions in Xcode 3, but such functionality seems either gone or hidden in Xcode 4.


Solution

  • Regular expression replace is still available in Xcode 4. Use "Replace" and set style to "Regular Expression", use "([^"]*)"; as pattern and replace with "BLAH";.