regex - How do I check for this odd space character - " " in Objective-C? -


i wrote regex play spaces in strings, , works beautifully, except when come across character: " " instead of " ". think i'm crazy, apparently they're different. check out regex app (oddly enough, crashes it):

when use weird space:

enter image description here

when use normal space:

enter image description here

as can see, there many more spaces detected here, doesn't detect weird spaces.

what space? how rid of it?

unicode has lot of different space characters. space posted in question -- in both title , body -- regular ascii space, old u+0020.

if want check you've copied onto clipboard, can run command pbpaste(1) on mac os x. example, if copied non-breaking space (u+00a0), identify so:

# write pasteboard contents stdout, convert utf-8 utf-32 easy # code point identification, hex dump contents $ pbpaste | iconv -f utf-8 -t utf-32be | hexdump -c 00000000  00 00 00 a0                                       |....| 00000004 

depending on regex engine you're using, may not support them all, if use \s character class. if want sure match space character have, include explicitly in character class, e.g. [\s<yourspacehere>], <yourspacehere> copy+pasted character want match.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -