error 027: invalid character constant - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: error 027: invalid character constant (
/showthread.php?tid=533206)
error 027: invalid character constant -
Emre__ - 23.08.2014
Hello,
I'm using regex replace to remove
Код:
nextid="checkpoint () (1231)"
from a line. I use expression nextid="\w+\s\(\)\s\([0-9]{1,5}\)"\s. This works on Notepad++ but when it comes to code below it give me error:
error 027: invalid character constant
pawn Код:
regex_replace(line, 'nextid="\w+\s\(\)\s\([0-9]{1,5}\)"\s', "", line, sizeof line); // remove nextid from line.
I tried to escape "\" character with "\" but still get the same error.
Re: error 027: invalid character constant -
Misiur - 23.08.2014
In PAWN single quote (') is used for single characters (try 'A' == 65), and double quote (") for strings. So:
pawn Код:
regex_replace(line, "nextid=\"\\w+\\s\\(\\)\\s\\([0-9]{1,5}\\)\"\\s", "", line, sizeof line);
(Take a note that I escaped double quotes inside the string)
#E:
Updated, you have to escape \ as well.
Re: error 027: invalid character constant -
Emre__ - 23.08.2014
Quote:
Originally Posted by Misiur
In PAWN single quote (') is used for single characters (try 'A' == 65), and double quote (") for strings. So:
pawn Код:
regex_replace(line, "nextid=\"\\w+\\s\\(\\)\\s\\([0-9]{1,5}\\)\"\\s", "", line, sizeof line);
(Take a note that I escaped double quotes inside the string)
#E:
Updated, you have to escape \ as well.
|
Thanks!! That solved the problem.
Edit: Pawn Compiled successfully but no replace done when file loaded.