java - Writing regex for string containing no only numbers -
i need write regex containing not digits [0-9]
. how can without explicitly specifying possible charaters in group. possible through lookahead/lookbehind? examples:
034987694 - doesn't match 23984576s9879 - match rtfsdbhkjdfg - match =-0io[-09uhidkbf - match 9347659837564983467 - doesn't match
^(?!\\d+$).*$
this should you.see demo.
https://regex101.com/r/fm9ly3/1
the negative lookahead check if string doesnt have integers
start end.you need $
make sure check till end or else check @ start.
Comments
Post a Comment