View Single Post
karaulov
Senior Member
Join Date: Jul 2018
Old 11-20-2019 , 23:08   Re: Find IP:PORT in string without REGEX module?
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
RegEx was designed for flexibility. If you need flexibility, use RegEx. If you want to check for a static IP and port, use a string compare.

A RegEx pattern for IP and port won't likely cause any significant performance issues. In fact, it may be more efficient than other methods if you have more than a handful of static IPs to check. Just remember to precompile the pattern.
I got drop fps every say message, i use pattern found on this forums!

Code:
#define PATTERN                "(?:(?:2\s*5\s*[0-5]|2\s*[0-4]\s*[0-9]|1\s*[0-9]\s*[0-9]|[1-9]?\s*[0-9])\s*\.\s*){3}(?:2\s*5\s*[0-5]|2\s*[0-4]\s*[0-9]|1\s*[0-9]\s*[0-9]|[1-9]?\s*[0-9])"
Maybe this pattern is bad ? This pattern \d+\.\d+\.\d+\.\d+:\d+ can work, too?

I test join player/say message. And every player join - fps drop from 1000 to 900 (for example, 100 ms sleep), every say message, too.

Last edited by karaulov; 11-20-2019 at 23:17.
karaulov is offline