Expression
var regex = new Regex(@"{([A-z]*)(([^]|:)((\\:)|[^:])*?)(([^]|:)((\\:)|[^:])*?)}");
Structure
The expression [roughly] is intended to search for tokens inside the input using the format:, {name[:pattern[:format]]}where patternand formatare optional.
{
([A-z]*)
(([^]|:)((\\:)|[^:])*?)
(([^]|:)((\\:)|[^:])*?)
}
In addition, the expression attempts to ignore the escaped colon, which allows the use of strings such as {Time:\d+\:\d+\:\d+:hh\:mm\:ss}
Question
When testing RegExr.com everything works enough, however, when you try to use the same template in C #, the input does not work, why
(Any recommendations for general expression enhancements are also very welcome)
source
share