Exemplo n.º 1
0
 /// <summary>
 /// Creates a new regular expression instance by copying the pattern and flags from another
 /// RegExp instance.
 /// </summary>
 /// <param name="prototype"> The next object in the prototype chain. </param>
 /// <param name="existingInstance"> The instance to copy the pattern and flags from. </param>
 internal RegExp(RegExp existingInstance)
 {
     if (existingInstance == null)
     {
         throw new ArgumentNullException("existingInstance");
     }
     this.value        = existingInstance.value;
     this.globalSearch = existingInstance.globalSearch;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Splits this string into an array of strings by separating the string into substrings.
        /// </summary>
        /// <param name="thisObj"> The string that is being operated on. </param>
        /// <param name="regExp"> A regular expression that indicates where to split the string. </param>
        /// <param name="limit"> The maximum number of array items to return.  Defaults to unlimited. </param>
        /// <returns> An array containing the split strings. </returns>
        internal static Nitrassic.Library.Array Split(ScriptEngine engine, string thisObj, RegExp regExp, uint limit)
        {
            if (limit == 0)
            {
                limit = uint.MaxValue;
            }

            return(regExp.Split(engine, thisObj, limit));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Returns a copy of this string with text replaced using a regular expression and a
 /// replacement function.
 /// </summary>
 /// <param name="thisObj"> The string that is being operated on. </param>
 /// <param name="regExp"> The regular expression to search for. </param>
 /// <param name="replaceFunction"> A function that is called to produce the text to replace
 /// for every successful match. </param>
 /// <returns> A copy of this string with text replaced using a regular expression. </returns>
 internal static string Replace(string thisObj, RegExp regExp, FunctionInstance replaceFunction)
 {
     return(regExp.Replace(thisObj, replaceFunction));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Returns a copy of this string with text replaced using a regular expression.
 /// </summary>
 /// <param name="thisObj"> The string that is being operated on. </param>
 /// <param name="regExp"> The regular expression to search for. </param>
 /// <param name="replaceText"> A string containing the text to replace for every successful match. </param>
 /// <returns> A copy of this string with text replaced using a regular expression. </returns>
 internal static string Replace(string thisObj, RegExp regExp, string replaceText)
 {
     return(regExp.Replace(thisObj, replaceText));
 }