using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"NSLocalizedString\((.*)\s*,\s*(.*)\)";
string input = @"// With text and comment
NSLocalizedString(@""Example Text"", @""Example Comment"");
// With text and no comment
NSLocalizedString(@""Example, text"", nil)
// With text and comment with paranthesis
NSLocalizedString(@""Example text"", @""Example (with paranthesis) comment"")
// With property and no comment
NSLocalizedString(test, nil)
// With property and comment
NSLocalizedString(test, @""Example comment"")
// Inline
NSLocalizedString(@""Error"", nil) NSLocalizedString(@""Change settings"", @""Option to change HTTP Post settings"") NSLocalizedString(@""Cancel"", nil)";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx