I have a question related to regular expressions in C #.
I want to find text between characters. Example:
Enum resultado = SPDialogBox.Instance.show<ACTION_ENUMs.TORNEO_SORTEAR>("Esto es una prueba");
Matches: Esto es una prueba
But in this example
Enum resultado = SPDialogBox.Instance.show<ACTION_ENUMs.TORNEO_SORTEAR>("Esto es una prueba");
pKR_MESAPUESTOASIGNACION.CONFIGTORNEO_ID = Valid.GetInt(dr.Cells["CONFIGTORNEO_ID"].Value);
Matches: Esto es una pruebabut should not match CONFIGTORNEO_ID, because they are written between square brackets ( [])
In short, I want to match a string between double quote characters ( "), but this string cannot be written between square brackets ( []).
Here is my code:
var pattern = "\"(.*?)\"";
var matches = Regex.Matches(fullCode, pattern, RegexOptions.Multiline);
foreach (Match m in matches)
{
Console.WriteLine(m.Groups[1]);
}
This pattern matches the entire line between characters ", but how can I change the pattern to exclude those lines that are written between square brackets?
- change ---
here is another example:
List<String> IdSorteados = new List<String>();
int TablesToSort = 0;
foreach (UltraGridRow dr in fg.hfg_Rows)
{
if (dr.Cells["MESA_ID"].Value == DBNull.Value && dr.Cells["Puesto"].Value == DBNull.Value && !Valid.GetBoolean(dr.Cells["BELIMINADO"].Value) && (Valid.GetBoolean(dr.Cells["Seleccionado"].Value) || SortearTodo))
TablesToSort++;
}
MESA_ID ( Cells["MESA_ID"].Value) Puesto ( Cells["Puesto"].Value). ].Value == DBNull.Value && dr.Cells[ ( ["MESA_ID"].Value == DBNull.Value && dr.Cells["Puesto"])
, .