java - Match a character exactly once with regex -


how can match character once regex in java? let's want strings contain 1 time digit 3, , doesn't matter is.

i tried ".*3{1}.*" match "330" specified period don't care character is. how can fix this?

^[^3]*3[^3]*$ 

match (not three), three, (not three).

edit: adding ^ , $ @ beginning , end. force regex match whole line. @bobbyrogers , @mindastic


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -