I'm trying to regex groups matching the same pattern using C#. Here is a little example which I can't get to work.
I need to get all the strings between the single quotes (CodigoEmpresa, for example)
uses MainRecord, objErrorList, SysUtils, XMLMXMWebServiceReturn, objMainProcesso,
objProcessoWS, objProcessaRelatorioQuickReport, QuickRpt, Forms,
RBalanc, RBalancete, RBaCCMens, RBalaMensal, RBalaMensalCons,
objcadcontabilidade, objContabilidadeValidacoes;
const
CODIGO_EMPRESA = 'CodigoEmpresa';
ANO_MES = 'AnoMes';
RELATORIO_POR = 'RelatorioPOR';
CONTA_INI = 'ContaIni';
CONTA_FIM = 'ContaFim';
GRAU_CONTA = 'GrauConta';
CCUSTOS_INI = 'CCustosIni';
CCUSTOS_FIM = 'CCustosFim';
GRAU_CCUSTOS = 'GrauCCustos';
DETALHAR_CONSOLIDADO = 'DetalharConsolidado';
DESCONSIDERAR_ENCERRAMENTO = 'DesconsiderarEncerramento';
QUEBRA_CCUSTO = 'QuebraCCusto';
CONTAS_SEM_MOVIMENTO = 'ContasSemMovimento';
CODIGO_ALTERNATIVO = 'CodigoAlternativo';
const
ERROR_BALANCETE_MENSAL_0001 = 'BALANC0001';
ERROR_BALANCETE_MENSAL_0002 = 'BALANC0002'; //Empresa Inexistente
ERROR_BALANCETE_MENSAL_0003 = 'BALANC0003';
ERROR_BALANCETE_MENSAL_0004 = 'BALANC0004';
ERROR_BALANCETE_MENSAL_0005 = 'BALANC0005';
ERROR_BALANCETE_MENSAL_0006 = 'BALANC0006';
ERROR_BALANCETE_MENSAL_0007 = 'BALANC0007';
ERROR_BALANCETE_MENSAL_0008 = 'BALANC0008';
I've tried that so far:
Match match = Regex.Match(delphiFileInText, @"const.+=\s*'(?<property>[\d\w]+)'", RegexOptions.IgnoreCase | RegexOptions.Singleline);
But all I get is that last match (BALANC0008);
I hope I can be clear. Thanks for help
CONST.+?(EST)ING+orCONST(.+(EST)ING+)?I think.