given a user submitted input String, filter out any invalid or restricted html.

@param input text (i.e. submitted by a user) than may contain html
@return "clean" version of input, with only valid, whitelisted html elements allowed
335574
public String filter(final String input) {
		reset();
		String s = input;

		debug("************************************************");
		debug("              INPUT: " + input);

		s = escapeComments(s);
		debug("     escapeComments: " + s);

		s = balanceHTML(s);
		debug("        balanceHTML: " + s);

		s = checkTags(s);
		debug("          checkTags: " + s);

		s = processRemoveBlanks(s);
		debug("processRemoveBlanks: " + s);

		s = validateEntities(s);
		debug("    validateEntites: " + s);

		debug("************************************************\n\n");
		return s;
	}
131242
public static boolean isValidJavaClassName(String input) {
		if (!StringUtils.hasText(input)) {
			return false;
		}
		if (!Character.isJavaIdentifierStart(input.charAt(0))) {
			return false;
		}
		if (input.length() > 1) {
			for (int i = 1; i < input.length(); i++) {
				if (!Character.isJavaIdentifierPart(input.charAt(i))) {
					return false;
				}
			}
		}
		return true;
	}
911181
public static String htmlEncode(String input)
	{
		if (input == null)
		{
			return "";
		}
		StringBuffer retval = new StringBuffer(input);
		StringSupport.replaceAll(retval, "&", "&amp;");
		StringSupport.replaceAll(retval, "<", "&lt;");
		StringSupport.replaceAll(retval, ">", "&gt;");
		StringSupport.replaceAll(retval, "\"", "&quot;");
		return retval.toString();
	}
707849
public static UnicodeFriendlyString stripAccents(final UnicodeFriendlyString input) {
    // this nifty normalization courtesy of http://stackoverflow.com/questions/3322152/is-there-a-way-to-get-rid-of-accents-and-convert-a-whole-string-to-regular-lette
    return StringUtils.unicodeFriendly(ACCENT_STRIPPER.matcher(
        Normalizer.normalize(input.utf16CodeUnits(), Normalizer.Form.NFD))
        // note this replaceAll is really deleteAll
        .replaceAll(""));
  }
1024854
function( input ) {

		if ( input == null ) {

			input = this.result;

		}
		 	this.result = input;

		  this.alphaNum(this.result);

			this.halfSpace( this.result );

			this.removeArabicChar( this.result );

			return this;

		}
1201360
@SuppressWarnings("unchecked")
    public T parse(String input) throws Exception {
        validate(input);
        setContent(input);
        return (T) this;
    }
517501
public static String toPlain(String input) {
        Matcher matcher = SPACE_PATTERN.matcher(input);
        if (matcher.find()) {
            return matcher.replaceAll("");
        } else {
            return input;
        }
    }
468604
@Override
    public boolean isValid(Object input) {
        long value;
        try {
            value = Long.parseLong(input.toString());
        } catch (NumberFormatException e) {
            return false;
        }

        if (minAllowedValue != null && value < minAllowedValue)
            return false;
        if (maxAllowedValue != null && value > maxAllowedValue)
            return false;

        return true;
    }
1176311
public String filter(String input) {

        StringBuilder output = new StringBuilder();
        Matcher tokenMatcher = tokenPattern.matcher(input);

        // Track last regex match
        int endOfLastMatch = 0;

        // For each possible token
        while (tokenMatcher.find()) {

            // Pull possible leading text and first char before possible token
            String literal = tokenMatcher.group(LEADING_TEXT_GROUP);
            String escape = tokenMatcher.group(ESCAPE_CHAR_GROUP);

            // Append leading non-token text
            output.append(literal);

            // If char before token is '$', the token itself is escaped
            if ("$".equals(escape)) {
                String notToken = tokenMatcher.group(TOKEN_GROUP);
                output.append(notToken);
            }

            // If char is not '$', interpret as a token
            else {

                // The char before the token, if any, is a literal
                output.append(escape);

                // Pull token value
                String tokenName = tokenMatcher.group(TOKEN_NAME_GROUP);
                String tokenValue = getToken(tokenName);

                // If token is unknown, interpret as literal
                if (tokenValue == null) {
                    String notToken = tokenMatcher.group(TOKEN_GROUP);
                    output.append(notToken);
                }

                // Otherwise, substitute value
                else
                    output.append(tokenValue);

            }

            // Update last regex match
            endOfLastMatch = tokenMatcher.end();
            
        }

        // Append any remaining non-token text
        output.append(input.substring(endOfLastMatch));
        
        return output.toString();
       
    }
213256
def remove_html_tag(input_str='', tag=None):
    
    result = input_str
    if tag is not None:
        pattern = re.compile('<{tag}[\s\S]+?/{tag}>'.format(tag=tag))
        result = re.sub(pattern, '', str(input_str))

    return result
342860
public static String trimFront(String input) {
		int i = 0;
		while (i < input.length() && Character.isWhitespace(input.charAt(i)))
			i++;
		return input.substring(i);
	}
175824
String getHiddenInputHtmlForRequestParameters() {
        StringBuilder html = new StringBuilder();
        if (parameterMap != null) {
            Set<Entry<String, String[]>> entries = parameterMap.entrySet();
            for (Entry<String, String[]> entry : entries) {
                html.append(getHiddenInputForRequestParam(entry));
            }
        }
        return html.toString();
    }
846403
public static void notBlank(final String input, final String inputName) {
        notNull(input, inputName);

        if (StringUtils.isBlank(input)) {
            throw new IllegalArgumentException("Expecting " + maskNullArgument(inputName) + " to be a non blank value.");
        }
    }
690013
private String removeScriptTags(String input) {

        Pattern removePattern = Pattern.compile("<script[^>]*?>[\\s\\S]*?<\\/script>");
        Matcher match = removePattern.matcher(input);
        return match.replaceAll("");
    }
788429
private String removeBeginningAt(final String input,
            final String searchString) {
        final int i = input.indexOf(searchString);
        if (i != -1) {
            return input.substring(i + 1, input.length());
        }
        return input;
    }
383797
public static boolean isMatch(final String regex, final CharSequence input) {
        return input != null && input.length() > 0 && Pattern.matches(regex, input);
    }
956249
public static Template parse(String input) {
        return new Template(input, Tag.getTags(), Filter.getFilters());
    }