StaticescapeEscape HTML special characters to prevent XSS
StatichighlightHighlight matching text in a string based on the filter text. IMPORTANT: Only highlights if the text actually matches the pattern. For wildcard searches, all segments must be present in order.
The text to highlight
The search term (may include % wildcards)
Whether to escape HTML characters (default: true)
HTML string with highlighted matches, or the original text if no match
StaticmatchesCheck if a value matches the search term (supports SQL-style % wildcards) This is used for filtering records.
The text value to check
The search term (may include % wildcards)
true if the value matches the search pattern
HighlightUtil - Utility class for highlighting search matches in text
This class provides methods to:
The key distinction is that highlighting should only occur when the text actually matches the search pattern. For wildcard searches like "food%ass", the text must contain "food" followed by "ass" in order - we shouldn't highlight partial matches that don't satisfy the full pattern.