I'm trying to extract the strings for localization
. There are so many files where some of the strings are tagged as NSLocalizedStrings
, and some of them are not.
I'm able to grab the NSLocalizedStrings
using ibtool
and genstrings
, but I'm unable to extract the plain strings without NSLocalizedString
.
I'm not good at regex, but I came up with this "[^(]@\""
and with the help of grep:
grep -i -r -I "[^(]@\"" * > out.txt
It worked, and all the strings were actually grabbed into a txt file, but the problem is ,
if in my code there is a line:
..... initWithTitle:@"New Sketch".....
I only expect the grep to grab the @"New Sketch"
part, but it grabs the whole line.
So in the out.txt
file, I see initWithTitle:@"New Sketch"
, along with some unwanted lines.
How can I write the regex to grab only the strings in double quotes ?
I tried the grep command with the regex mentioned in here, but it gave me syntax error .
For ex, I tried:
grep -i -r -I (["'])(?:(?=(\\?))\2.)*?\1 * > out.txt
and it gave me
-bash: syntax error near unexpected token `('