本文整理汇总了C#中BsonWriter.WriteRegex方法的典型用法代码示例。如果您正苦于以下问题:C# BsonWriter.WriteRegex方法的具体用法?C# BsonWriter.WriteRegex怎么用?C# BsonWriter.WriteRegex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BsonWriter
的用法示例。
在下文中一共展示了BsonWriter.WriteRegex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteBson
private void WriteBson(BsonWriter writer, Regex regex)
{
// Regular expression - The first cstring is the regex pattern, the second
// is the regex options string. Options are identified by characters, which
// must be stored in alphabetical order. Valid options are 'i' for case
// insensitive matching, 'm' for multiline matching, 'x' for verbose mode,
// 'l' to make \w, \W, etc. locale dependent, 's' for dotall mode
// ('.' matches everything), and 'u' to make \w, \W, etc. match unicode.
string options = null;
if (HasFlag(regex.Options, RegexOptions.IgnoreCase))
options += "i";
if (HasFlag(regex.Options, RegexOptions.Multiline))
options += "m";
if (HasFlag(regex.Options, RegexOptions.Singleline))
options += "s";
options += "u";
if (HasFlag(regex.Options, RegexOptions.ExplicitCapture))
options += "x";
writer.WriteRegex(regex.ToString(), options);
}