Delimiters setting to RegExp source

@param {*} val The delimiter settings.
@param {Array} defaultDelimiters The default delimiters.
@returns {string} The delimiters RegExp source.
329827
function settingToRegExpInfo(val, defaultDelimiters) {
    if (!val) {
        return {
            pattern: `${defaultDelimiters[0]}([\\s\\S]*?)${
                defaultDelimiters[1]
            }`,
            getDelimiters: () => defaultDelimiters,
        }
    }
    if (Array.isArray(val)) {
        return {
            pattern: `${escapeRegExp(val[0])}([\\s\\S]*?)${escapeRegExp(
                val[1]
            )}`,
            getDelimiters: () => val,
        }
    }

    const source = val instanceof RegExp ? val.source : `${val}`
    const pattern =
        source.indexOf("([\\s\\S]+?)") >= 0
            ? source.replace("([\\s\\S]+?)", "([\\s\\S]*?)")
            : source.indexOf("([\\S\\s]+?)") >= 0
            ? source.replace("([\\S\\s]+?)", "([\\s\\S]*?)")
            : source

    let getDelimiters = undefined
    const delmPattern = pattern.split("([\\s\\S]*?)")
    if (delmPattern.length === 2) {
        const re = new RegExp(
            delmPattern.map(s => `(${s})`).join("([\\s\\S]*?)"),
            "u"
        )
        getDelimiters = (text, innerCode) => {
            const r = text.match(re)
            if (r) {
                return [r[1], r[3]]
            }
            return getDelimitersFinalMeans(text, innerCode)
        }
    } else {
        getDelimiters = getDelimitersFinalMeans
    }
    return {
        pattern,
        getDelimiters,
    }
}
996336
function maybeMapOverVal(fn, val) {
  var vals = val.split(',');
  if (vals.length > 1) {
    return vals.map(function(v) { return v == '.' ? null : fn(v); });
  }
  return val == '.' ? null : fn(val);
}
1099156
function regex (strings, ...args) {
  return String.raw(strings, ...args.map(_.escapeRegExp))
}
943689
function camelCase(str, delim) {
        var delims = delim || ['_', '.', '-'];

        if (!_.isArray(delims)) {
            delims = [delims];
        }

        _.each(delims, function (adelim) {
            var codeParts = str.split(adelim);
            var i, codePart;

            for (i = 1; i < codeParts.length; i++) {
                codePart = codeParts[i];
                codeParts[i] = codePart.substring(0, 1).toUpperCase() + codePart.substring(1);
            }

            str = codeParts.join('');
        });

        return str;
    }
1038786
function(line) {
        var newLine;

        // ex: [foo <- 1,2,3]
        // [        opening array
        //   (.*)   $1 array to concat into
        //   (<-)   $2
        //   (.*)   $3 content to be merged
        // ]        closing array
        var regexArr = /\[(.*)(\<\-)(.*)\]/;

        // ex: {foo <- foo: true, bar: 2}
        // {        opening object
        //   (.*)   $1 obj to merge into
        //   (<-)   $2
        //   (.*)   $3 content to be merged
        // }        closing object
        var regexObj = /\{(.*)(\<\-)(.*)\}/;

        newLine = line.replace(regexArr, function($0, $1, $2, $3) {
            return $1.trim() + '.concat([' + $3 + ']);';
        });

        return newLine.replace(regexObj, function($0, $1, $2, $3) {
            return $1.trim() + '.merge({' + $3 + '});';
        });
    }
590633
function make_regex(tokens) {
	var str = tokens.reduce(function (res, token, index) {
			var is_last = (index == (tokens.length - 1));
			var before_multi = (index === (tokens.length - 2)) && (last(tokens).type == "multi");
			return res + ((is_last || before_multi) ? token.last : token.piece);
		},
		"");
	return new RegExp("^" + str + "$");
}
1118258
function delimsObject(delims) {
  var a = delims[0], b = delims[1];
  var res = {};
  res.interpolate = lazy.delimiters(a + '=', b);
  res.evaluate = lazy.delimiters(a, b);
  res.escape = lazy.delimiters(a + '-', b);
  return res;
}
1201521
function(val){
			val = val.toLowerCase();
			var that = this;
			$.each( CPGlobal.stringParsers, function( i, parser ) {
				var match = parser.re.exec( val ),
					values = match && parser.parse( match ),
					space = parser.space||'rgba';
				if ( values ) {
					if (space === 'hsla') {
						that.value = CPGlobal.RGBtoHSB.apply(null, CPGlobal.HSLtoRGB.apply(null, values));
					} else {
						that.value = CPGlobal.RGBtoHSB.apply(null, values);
					}
					return false;
				}
			});
		}
379116
function Delimiters (delims, options) {
  this.options = options || {};
  this.delims = delims || [];

  this.defaults = merge({}, {
    beginning: '^',           // '^' Matches beginning of input.
    matter: '([\\s\\S]+?)',   // The "content" between the delims
    body: '([\\s\\S]+|\\s?)', // The "content" after the delims
    end: '$',                 // '$' Matches end of input.
    flags: ''                 // RegExp flags: g, m, i
  }, options);
}
280522
static Selector parseIntegerLiteral(String val) {
    // Determine if this is a long constant by checking the suffix
    char tag = val.charAt(val.length()-1);
    boolean mustBeLong = false;
    if (tag == 'l' || tag == 'L') 
    {
      val = val.substring(0, val.length()-1);
      mustBeLong = true;
    }
    long longVal = Long.decode(val).longValue();
    if (mustBeLong || longVal > Integer.MAX_VALUE || longVal < Integer.MIN_VALUE)
      return new LiteralImpl(new Long(longVal));
    else
      return new LiteralImpl(new Integer((int) longVal));
  }
667268
function _matchRegExp(val) {
  const expression = `${_escapeRegExp(val)}($|\\s|\\>|\\+|~|\\:|\\[)`;
  let expressionPrefix = '(^|\\s|\\>|\\+|~)';
  if (_isPlaceholder(val)) {
    // We just want to match an empty group here to preserve the arguments we
    // may be expecting in a RegExp match.
    expressionPrefix = '()';
  }
  return new RegExp(expressionPrefix + expression, 'g');
}
1148090
public static DelimitRegExIterator<String> defaultDelimitRegExIterator(Reader in, String delimiter) {
    return new DelimitRegExIterator<String>(in, delimiter, new IdentityFunction<String>());
  }
581505
public static long parseLong(String val, long defValue){
        if(TextUtils.isEmpty(val)) return defValue;
        try{
            return Long.parseLong(val);
        }catch (NumberFormatException e){
            return defValue;
        }
    }
1355863
public static boolean isDelimiter(String str)
    {
        if (str != null && ("-".equals(str) || "－".equals(str)))
            return true;
        else
            return false;
    }
301042
function _replaceRegExp(val) {
  const operatorRegex = /(::?|\[)/g;
  const newVal = (val.match(operatorRegex)) ? val.substring(0, val.search(operatorRegex)) : val;
  return _matchRegExp(newVal);
}
606181
function (regexName, regex, content, results) {
      var r;
      _log.debug("---------------------------------------------------------------------------------------------------");
      _log.debug('Process extraction with regex : "' + regexName + '"');
      _log.debug(regex);
      regex.lastIndex = 0;
      while ((r = regex.exec(content)) !== null) {

        // Result expected [STRING, KEY, SOME_REGEX_STUF]
        // Except for plural hack [STRING, KEY, ARRAY_IN_STRING]
        if (r.length >= 2) {
          var translationKey, evalString;
          var translationDefaultValue = "";

          switch (regexName) {
            case 'HtmlDirectiveSimpleQuote':
            case 'HtmlDirectiveDoubleQuote':
              translationKey = r[1].trim();
              translationDefaultValue = (r[2] || "").trim();
              break;
            case 'HtmlDirectivePluralFirst':
              if (!r.length > 2) {
                return;
              }
              var tmp = r[1];
              r[1] = r[2];
              r[2] = tmp;
            case 'HtmlDirectivePluralLast':
              evalString = eval(r[2]);
              if (_.isArray(evalString) && evalString.length >= 2) {
                translationDefaultValue = "{NB, plural, one{" + evalString[0] + "} other{" + evalString[1] + "}" + (evalString[2] ? ' ' + evalString[2] : '') + "}";
              }
              translationKey = r[1].trim();
              break;
            default:
              translationKey = r[1].trim();
          }

          // Avoid empty translation
          if (translationKey === "") {
            return;
          }

          switch (regexName) {
            case "commentSimpleQuote":
            case "HtmlFilterSimpleQuote":
            case "JavascriptServiceSimpleQuote":
            case "JavascriptServiceInstantSimpleQuote":
            case "JavascriptFilterSimpleQuote":
            case "HtmlNgBindHtml":
              translationKey = translationKey.replace(/\\\'/g, "'");
              break;
            case "commentDoubleQuote":
            case "HtmlFilterDoubleQuote":
            case "JavascriptServiceDoubleQuote":
            case "JavascriptServiceInstantDoubleQuote":
            case "JavascriptFilterDoubleQuote":
              translationKey = translationKey.replace(/\\\"/g, '"');
              break;
            case "JavascriptServiceArraySimpleQuote":
            case "JavascriptServiceArrayDoubleQuote":
              var key;

              if(regexName === "JavascriptServiceArraySimpleQuote") {
                key = translationKey.replace(/'/g, '');
              } else {
                key = translationKey.replace(/"/g, '');
              }
              key = key.replace(/[\][]/g, '');
              key = key.split(',');

              key.forEach(function(item){
                item = item.replace(/\\\"/g, '"').trim();
                if (item !== '') {
                  results[item] = translationDefaultValue;
                }
              });
              break;
          }

          // Check for customRegex
          if (_.isObject(customRegex) && !_.isArray(customRegex) && customRegex.hasOwnProperty(regexName)) {
            if (_.isFunction(customRegex[regexName])) {
              translationKey = customRegex[regexName](translationKey) || translationKey;
            }
          }

          // Store the translationKey with the value into results
          var defaultValueByTranslationKey = function (translationKey, translationDefaultValue) {
            if (regexName !== "JavascriptServiceArraySimpleQuote" &&
              regexName !== "JavascriptServiceArrayDoubleQuote") {
              if (keyAsText === true && translationDefaultValue.length === 0) {
                results[translationKey] = translationKey;
              } else {
                results[translationKey] = translationDefaultValue;
              }
            }
          }

          // Ternary operation
          var ternaryKeys = _extractTernaryKey(translationKey)
          if (ternaryKeys) {
            _.forEach(ternaryKeys, function(v) {
              defaultValueByTranslationKey(v);
            });
          } else {
            defaultValueByTranslationKey(translationKey, translationDefaultValue);
          }

        }
      }
    }
650957
function qstring(val) {
  var str = String(val)

  // no need to quote tokens
  if (tokenRegExp.test(str)) {
    return str
  }

  if (str.length > 0 && !textRegExp.test(str)) {
    throw new TypeError('invalid parameter value')
  }

  return '"' + str.replace(quoteRegExp, '\\$1') + '"'
}