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
Post a Comment