s-yadav / react-number-format

React component to format numbers in an input or as a text.
MIT License
3.85k stars 404 forks source link

IPv4 Address Mask #821

Closed wallace-sf closed 4 months ago

wallace-sf commented 7 months ago

Hi guys. How can i create a IPv4 mask? I have tried several approches, but haven't been successful. The fact that an IPv4 address can have different digits sizes like: 0.0.0.0 or 255.255.255.255 is preventing me to create a useful mask.

Use cases:

How can i create a mask for these cases?

s-yadav commented 6 months ago

Hey @wallace-sf, please check if custom formatting helps. Here's an example of a similar case. https://s-yadav.github.io/react-number-format/docs/customization#card-expiry-field-with-usepatternformat