Posts: 3,004
Threads: 12
Joined: May 2011
Quote:
Originally Posted by Kar
Is this correct usage of this plugin's functions?
pawn Code:
#if defined _pawnregex_included regex_IsValidIP(const string[]) { // = \\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)+([(/|,.)?\\s]{1,})+(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)+([(/|,.)?\\s]{1,})+(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)+([(/|,.)?\\s]{1,})+(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b // Pooh7's second // = ([0-9\\s]{1,})+([(\/|_,.)?\\s]{1,})+([0-9\\s]{1,})+([(\/|_,.)?\\s]{1,})+([0-9\\s]{1,})+([(\/|_,.)?\\s]{1,})+([0-9\\s]{1,}) Pooh7's // = (.*?)([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})(.*?) // = ((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)([\s\.\$]+)){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\s*:\s*[0-9]+)?
new result, regex:ipRegex = Regex_New("((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)([\s\.\$\,\_\-\@\!\#\+\=\<\>]+)){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\s*:\s*[0-9]+)??"); result = Regex_Check(string, ipRegex); Regex_Delete(ipRegex); return result; } #endif
|
No, you'd need to escape once more the escapes.
The first escape should be for regex, if you leave it that way, you're escaping the chars in Pawn and it will send the regex without the escapes \
The second escape will escape from making the escapes disappear \\ and it will send the regex query with the escape \ and will work fine.
In other words, the first for pawn, the second for regex.