Deletes a group of items. Removes every key by a match string.

@param match
regex

@return Promise with empty value
490372
public final Promise clean(String match) {
		ScanArgs args = new ScanArgs();
		args.limit(100);
		boolean singleStar = match.indexOf('*') > -1;
		boolean doubleStar = match.contains("**");
		if (doubleStar) {
			args.match(match.replace("**", "*"));
		} else if (singleStar) {
			if (match.length() > 1 && match.indexOf('.') == -1) {
				match += '*';
			}
			args.match(match);
		} else {
			args.match(match);
		}
		if (!singleStar || doubleStar) {
			match = null;
		}
		if (client != null) {
			return new Promise(clean(client.scan(args), args, match));
		}
		if (clusteredClient != null) {
			return new Promise(clean(clusteredClient.scan(args), args, match));
		}
		return Promise.resolve();
	}
970499
function match(regexp) {
        var O = requireObjectCoercible(this);
        var matcher = regexp == undefined ? undefined : regexp[MATCH];
        return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
      }
324668
function (match) {
        assertType(match, Function);

        for (var i = 0, len = this.length; i < len; i++) {
            if (match(this[i]) === false) {
                return false;
            }
        }

        return true;
    }
1053758
function removeItemsFromList(list, itemsToRemove) {
    var result = [];

    _.each(list, function (item) {
        var valid = true;
        for (var i = 0; i < itemsToRemove.length; i++) {

            // if the item match one of the items to remove don't includ it in the result list
            if (item.indexOf(itemsToRemove[i]) === 0) {
                valid = false;
                break;
            }
        }

        if (valid) {
            result.push(item);
        }
    });

    return result;
}
545894
@Deprecated
    public PactDslJsonArray stringMatcher(String regex) {
      generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(1), new RandomStringGenerator(10));
      stringMatcher(regex, new Generex(regex).random());
      return this;
    }
1141863
function doDelete(filter) {
    console.log('folder delete called', filter);
    return new Promise(function(resolve, reject) {
      var keysPromise;
      var deletes = [], deletedKeys = [];

      if (common.keyTypes.indexOf(typeof filter) !== -1) {
        filter = [filter];
      } else if (filter instanceof Array) {
      } else if (filter === true || typeof filter === 'object') {
        console.log('object/true delete handler');
        // Get the existing keys
        readKeys().then(function(existingKeys) {
          console.log('existing keys are', existingKeys);
          if (filter === true) {
            deletedKeys = existingKeys;
            existingKeys.forEach(function(key) {
              deletes.push(saveData(key));
            });
          } else {
            if (options.cacheValues) {
              console.log('processing filter', filter);
              common.processFilter(cachedData, filter, function(key) {
                console.log('deleting matching item', key);
                deletes.push(saveData(key).then(function() {
                  delete cachedData[key];
                  deletedKeys.push(key);
                }));
              });
            } else {
              console.log('processing filter on non-cached data');
              existingKeys.forEach(function(key) {
                deletes.push(readData(key).then(function(data) {
                  console.log('loaded data for', key);
                  if (common.runFilter(data, filter)) {
                    return saveData(key).then(function() {
                      if (options.cacheKeys) {
                        cachedKeys.splice(cachedKeys.indexOf(key), 1);
                      }
                      deletedKeys.push(key);
                    });
                  } else {
                    return Promise.resolve();
                  }
                }));
              });
            }
          }

          return Promise.all(deletes).then(function() {
            if (filter === true && options.cacheValues) {
              cachedData = {};
            }
            if (options.cacheValues && options.cacheKeys) {
              cachedKeys = Object.keys(cachedData);
            } else if (filter === true && options.cacheKeys) {
              cachedKeys = [];
            }
            resolve(deletedKeys);
          });
        }).catch(function(error) {
          reject(error);
        });

        return;
      } else {
        reject({
          message: 'filter needs to be an object containing a filter'
        });
        return;
      }

      /* Get the list of keys */
      if (options.cacheKeys) {
        keysPromise = Promise.resolve(cachedKeys);
      } else {
        keysPromise = readKeys();
      }

      keysPromise.then(function(keys) {
        console.log('got current keys', keys);
        filter.forEach(function(id) {
          if (keys.indexOf(id) !== -1) {
            // TODO XXX Remove once file watch implemented
            deletes.push(saveData(id).then(function() {
              if (options.cacheValues) {
                delete cachedData[id];
              } else if (options.cacheKeys) {
                // Delete remove key from cached keys if caching keys but not values
                cachedKeys.splice(cachedKeys.indexOf(id), 1);
              }

              deletedKeys.push(id);
            }));
          }
        });

        Promise.all(deletes).then(function() {
          // Redo cached keys if caching keys and values (otherwise done above)
          if (options.cacheKeys && options.cacheValues) {
            cachedKeys = Object.keys(cachedData);
          }
          resolve(deletedKeys);
        });
      }).catch(function(error) {
        reject(error);
      });
    });
  }
639783
function(array, pattern) {
      for(var i=0; i<array.length; i++) {
        var match = array[i].match(pattern);
        if(match) {
          return match;
        }
      }

      return null;
    }
1034893
async function replace(string, regex, callback) {
	regex.lastIndex = 0;

	/* get all data */
	const promises = [];
	string.replace(regex, (match, ...args) => {
		const promise = callback(match, ...args);
		promises.push(promise);
	});
	const data = await Promise.all(promises);

	/* replace all data */
	return data.length ? string.replace(regex, () => data.shift()) : string;
}
1286207
public RouteMatcher delete(String pattern, Handler<HttpServerRequest> handler) {
		addPattern(pattern, handler, deleteBindings);
		return this;
	}
1144496
public boolean match(String str, String regex) {
		if (str == null || regex == null)
			return false;
		if (regex.trim().isEmpty())
			return true;
		return Pattern.compile(regex.trim()).matcher(str).find();
	}
316744
public boolean matches(String target, Match match) {
		return this.matches(target, 0, target.length(), match);
	}
408086
public static String[] split(String input, String regex) {
    if (input == null) {
      return null;
    }
    String[] arr = input.split(regex);
    List<String> results = new ArrayList<>(arr.length);
    for (String a : arr) {
      if (!a.trim().isEmpty()) {
        results.add(a);
      }
    }
    return results.toArray(new String[0]);
  }
1291290
public static String delAll(Pattern pattern, CharSequence content) {
		if (null == pattern || StrUtil.isBlank(content)) {
			return StrUtil.str(content);
		}

		return pattern.matcher(content).replaceAll(StrUtil.EMPTY);
	}
1149771
@Nullable
  static <T> T removeFirstMatching(Iterable<T> removeFrom, Predicate<? super T> predicate) {
    checkNotNull(predicate);
    Iterator<T> iterator = removeFrom.iterator();
    while (iterator.hasNext()) {
      T next = iterator.next();
      if (predicate.apply(next)) {
        iterator.remove();
        return next;
      }
    }
    return null;
  }
710477
def delete_key_pattern(obj, regx_pattern):
    '''  '''

    if isinstance(obj, list):
        _return_list = []
        for item in obj:
            if isinstance(item, list):
                _return_list.append(delete_key_pattern(item, regx_pattern))
            elif isinstance(item, set):
                _return_list.append(list(item))
            elif isinstance(item, dict):
                _return_list.append(delete_key_pattern(item, regx_pattern))
            else:
                try:
                    json.dumps(item)
                    _return_list.append(item)
                except:
                    _return_list.append(str(type(item)))
        return _return_list
    elif isinstance(obj, set):
        return list(obj)
    elif isinstance(obj, dict):
        _return_obj = {}
        for key, item in obj.items():
            if not re.match(regx_pattern, key):
                if isinstance(item, list):
                    _return_obj[key] = delete_key_pattern(item, regx_pattern)
                elif isinstance(item, set):
                    _return_obj[key] = list(item)
                elif isinstance(item, dict):
                    _return_obj[key] = delete_key_pattern(item, regx_pattern)
                else:
                    try:
                        json.dumps(item)
                        _return_obj[key] = item
                    except:
                        _return_obj[key] = str(type(item))
        return _return_obj
    else:
        try:
            json.dumps(obj)
            return obj
        except:
            return str(type(obj))
175398
public String match(String text){
		if(null == text){
			return null;
		}
		List<String> matchAll = matchAll(text, 1);
		if(CollectionUtil.isNotEmpty(matchAll)){
			return matchAll.get(0);
		}
		return null;
	}
654304
static Matcher removeStartFollowedByMatchAny(Matcher matcher) {
    if (matcher instanceof SeqMatcher) {
      List<Matcher> matchers = matcher.<SeqMatcher>as().matchers();
      if (matchers.size() == 2
          && matchers.get(0) instanceof StartMatcher
          && matchers.get(1) instanceof ZeroOrMoreMatcher) {
        ZeroOrMoreMatcher zm = matchers.get(1).as();
        if (zm.repeated() instanceof AnyMatcher) {
          return zm;
        }
      }
    }
    return matcher;
  }