clarkk clarkk - 4 months ago 7
PHP Question

regepx - odd whitespaces in string

I'm doing some regexp on some strings and in my pattern I match for whitespaces

\s


But in some strings I experience some strange spaces.. When converted to hex
a0


How to convert all strange spaces to a normal space so it can be detected with regexp and both
and
\s
?

When the string is presented as UTF8 all
a0
chars are represented as a


input in HEX



a03535a03832a03834a03135a02da053452e6e723aa0444ba03132a03638a03336a03933


input as string



 55 82 84 15 - SE.nr: DK 12 68 36 93

hsz hsz
Answer

a0 is a representation of   - non-breaking space.

You can match it with:

[\s\xA0]
Comments