AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Regex compiling error (https://forums.alliedmods.net/showthread.php?t=237646)

Neeeeeeeeeel.- 03-27-2014 21:22

Regex compiling error
 
PHP Code:

new szError[32];
if((
regex regex_compile("*HID\([a-zA-Z0-9]*)\", iRet, szError, charsmax(szError))) < REGEX_OK){
    log_amx("
REGEX ERROR: (%i) %s", iRet, szError);


Code:

22:15:47 L 03/27/2014 - 22:15:44: [test.amxx] REGEX ERROR: (20) \ at end of pattern
Why a regex could not end with \ ?

Example string:
teeestingggg*HID\helloman123\lalalala

I'm planning to run
PHP Code:

regex_match_c(inforegexiRet);
regex_substr(regex1hidcharsmax(hid)); 

So I could get "helloman123".

PS: I tried with "\\" it doesn't match.
PS2: I tried with "(?:*HID\([a-zA-Z0-9]*)\)" which is kind of workaround but I got "(3) nothing to repeat".

Finally I got the regex compiled... I forgot to escape first *
Solution: "\*HID\\([a-zA-Z0-9]*)\\"

fysiks 03-28-2014 05:08

Re: Regex compiling error
 
Yeah, it didn't know what character you were trying to escape (since the backslash is the escape character).


All times are GMT -4. The time now is 05:58.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.