java - How to replace all non-digit charaters in a string? -


i need replace non-digit charaters in string. instance:

string: 987sdf09870987=-0\\\`42 replaced: 987**sdf**09870987**=-**0**\\\`**42 

that's non-digit char-sequence wrapped ** charaters. how can string::replaceall()?

(?![0-9]+$).* 

the regex doesn't match want. how can that?

(\\d+) 

you can use , replace **$1**.see demo.

https://regex101.com/r/fm9ly3/2


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -