SanitizePlayerNameForRegex
Appearance
| 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 |
| str | UnSanitizedPlayerName – 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: | ||