I have a text that is a source-code file, I need to find the first parameter of all calls of this function. That can be called in this 2 ways. I'm completely dumb in regex.
lang('FOUND') and lang('FOUND',[loremipsum])
FOUND should be anything, is this value that I'm searching.
I will execute the Regexp in delphi, but I think regular expression is language independent
EDIT
Using the @Ken White answer and this Video I did this code, and works fine!
Regular expression: (?:lang\s*\(\s*')(.*?)(?:'\s*\)|'\s*\,\s*\[.*\]\s*\))
Include the Unit PerlRegEx on Uses
procedure TForm1.Button1Click(Sender: TObject);
var
Regex: TPerlRegEx;
begin
Regex := TPerlRegEx.Create();
Regex.RegEx := '(?:lang\s*\(\s*'')(.*?)(?:''\s*\)|''\s*,\s*\[.*\]\s*\))';
Regex.Options := [preCaseless, preMultiLine];
Regex.Subject := Memo1.Text;
if Regex.Match then
begin
repeat
Memo2.Lines.Add( Regex.Groups[1] );
until not Regex.MatchAgain;
end;
end;
langthat's surrounded by a quoted string in parentheses likelang('followed by some text until a closing)?