Example #1
0
 /// <summary>
 ///   Get the Match at a given capture index
 ///   <para>
 ///     Returns detailed match information for the given capture group.
 ///   </para>
 /// </summary>
 public Match this[int index]
 {
     get
     {
         var match   = new RureMatch();
         var matched = RureFfi.rure_captures_at(Raw,
                                                new UIntPtr((uint)index),
                                                out match);
         return(new Match(_haystack, matched, (uint)match.start, (uint)match.end));
     }
 }
Example #2
0
        /// <summary>
        ///   Find the extent of the first match.
        /// </summary>
        /// <param name="haystack">The UTF8 bytes to search for this pattern</param>
        /// <param name="offset">The offset to start searching at</param>
        public Match Find(byte[] haystack, uint offset)
        {
            var matchInfo = new RureMatch();

            var matched = RureFfi.rure_find(
                Raw, haystack,
                new UIntPtr((uint)haystack.Length),
                new UIntPtr(offset),
                out matchInfo);

            return(new Match(haystack, matched, (uint)matchInfo.start, (uint)matchInfo.end));
        }
Example #3
0
 public MatchIter(Regex pattern, byte[] haystack)
     : base(pattern, haystack)
 {
     _matchInfo = new RureMatch();
 }
Example #4
0
 public static extern bool rure_find(IntPtr re, byte[] haystack, UIntPtr length,
                                     UIntPtr start, out RureMatch match);
Example #5
0
 public static extern bool rure_captures_at(IntPtr captures,
                                            UIntPtr i,
                                            out RureMatch match);
Example #6
0
 public static extern bool rure_iter_next(IntPtr it,
                                          byte[] haystack,
                                          UIntPtr length,
                                          out RureMatch match);