In C#, I want to use a regular expression to match words within [[XXX]].
ex;
Vennligst betal følgende faktura: Fakturanr: [[INVOICENO]], Beløp: [[AMOUNT]], Forfall: [[DUEDATE]], KID: [[KID]] til konto: [[GYMACCOUNT]]. Mvh Aktiv365
In C#, I want to use a regular expression to match words within [[XXX]].
ex;
Vennligst betal følgende faktura: Fakturanr: [[INVOICENO]], Beløp: [[AMOUNT]], Forfall: [[DUEDATE]], KID: [[KID]] til konto: [[GYMACCOUNT]]. Mvh Aktiv365
You can use lookarounds to match the word inside square brackets.
(?<=\[\[)\w+(?=]])
\w+
one or more word characters(?<=\[\[)
if preceded by [[
(?=]])
if followed by ]]
You can use this pattern.
Regex r = new Regex(@"\[\[.+?]]");
var matches = r.Matches(input);