Jump to content

SanitizePlayerNameForRegex

From CMM Wiki
Revision as of 10:12, 11 November 2025 by Ozdeadmeat (talk | contribs) (sanitizePlayerNameForRegex – created via PowerShell script (2025-11-11T21:12:45Z))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Return to CMM Command Reference
Environment: Mission Scripting
Function: sanitizePlayerNameForRegex
Function Description: Sanitizes a player name string by replacing special regex characters with their escaped equivalents to ensure safe pattern matching in string operations.
File Location: cmm.stringFunctions.lua
Syntax: CMM.sanitizePlayerNameForRegex( string str )
Return Value: string
Parameters: Name Description
strUnSanitizedPlayerName – the input player name string that may contain regex-special characters such as %, (, ), ., +, -, *, ?, [, ], ^, $.
Example: CMM.sanitizePlayerNameForRegex("Player%Name+123")
Example Description: Returns "Player%Name+123" as all special characters are already escaped and no change occurs, demonstrating that the function preserves input when no special characters are present.
Related Functions:
Notes: