- Documentation
- Server functions
- pregFind
Function
pregFind
Checks whether a text matches a regular expression (JavaScript syntax). Flags as text ("i" - case-insensitive, "m" - multiline, "s" - dot matches newline, "u" - Unicode) or a number.
Syntax
bool pregFind(string subject, string pattern [, string/int flags = ""])Arguments
subjectstring- The text.
patternstring- Regular expression.
flagsstring/int, optional = ""- Flags.
Returns
true when it matches.
Example
addEventHandler("onPlayerChat", root, function(message)
if pregFind(message, "\\b(cheat|hack)\\b", "i") then
cancelEvent()
outputChatBox("Nie pisz o cheatach", source)
end
end)