I am writing up some PHP code. In this code, I am running a for loop within a for loop to iterate over an array, then to iterate over the characters in the current string in the array.
I then want to do preg_match() on the current string to see if it matches a rather ling RegEx.
preg_match('/[ \f\n\r\t\v\x{00a0}\x{1680}\x{180e}\x{2000-}\x{200a}\x{2028}\x{2029}\x{202f}\x{205f}\x{3000}\x{feff}]/', $input[$i][$j])
But I keep on receiving the following error:
WARNING preg_match(): Compilation failed: character value in \x{} or \o{} is too large at offset 27 on line number 25
Add UTF-8 parsing, you are not in UFT8 mode. Add the u
parameter.
preg_match('/[ \f\n\r\t\v\x{00a0}\x{1680}\x{180e}\x{2000-}\x{200a}\x{2028}\x{2029}\x{202f}\x{205f}\x{3000}\x{feff}]/u', $input[$i][$j]);
Also, i'd like to emphasize too that you have a typo. \x{2000-}
should be \x{2000}
or \x{2000}-
:
preg_match('/[ \f\n\r\t\v\x{00a0}\x{1680}\x{180e}\x{2000}\x{200a}\x{2028}\x{2029}\x{202f}\x{205f}\x{3000}\x{feff}]/u', $input[$i][$j]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With