S
Sam Phoneix
Heres the code. Why does it miss out the "a" character?
Heres the code. Why does it miss out the "a" character?
"This is a test".scan(/\w\w/) {|x| puts x}
Heres the code. Why does it miss out the "a" character?
Alle gioved=C3=AC 3 gennaio 2008, Sam Phoneix ha scritto:
I guess because the space before the 'a' is not a word character, so ' a'
can't match /\w\w/.
Stefano
David said:-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
your regex mataches 2 letter word characters. "a" is only one.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
iD8DBQFHfVNzUy30ODPkzl0RAucoAJ45N5rkzbbuMGr3jHAiF1NAwfPLrgCfeYo0
pDib5SU+hWuIJfKirdd9G6s=
=VpNa
-----END PGP SIGNATURE-----
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.