Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 0.71 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Regex [\S but not [[\S?
  2. Aka:  This is ok:  [s
  3.       This should be skipped:  [[s
  4.        
  5. foreach (Rule rule in rules)
  6. {
  7.     if (position + rule.Length > text.Length)
  8.         break;
  9.     if ((rule.PreCondition & condition) == rule.PreCondition)
  10.     {
  11.         if (substring.Length < rule.Length)
  12.             substring = text.Substring(position, rule.Length);
  13.         if (rule.Pattern.IsMatch(substring))
  14.         {
  15.             string previous = text.Substring(0, position);
  16.             sb.Append(previous);
  17.             text = text.Remove(0, position);
  18.             position = 0;
  19.             text = rule.Handler(new HandlerParameter(text, condition, previous));
  20.         }
  21.     }
  22. }
  23.        
  24. @"(?<![)[[^[s]"
  25.        
  26. @"(^|[^[])[[^[s]"
  27.        
  28. @"[[^s[]"