Is there a way to validate both IP address and IP address range in a single control using Angular? I have tried using the following code snippet:
controls["CapPoolVolExpolAldClientControl"].setValidators([Validators.required, Validators.pattern(/([0-9]){1,3}\.([0-9]){1,3}\.([0-9]){1,3}\.([0-9]){1,3}$/),Validators.pattern(/([0-9]){1,3}\.([0-9]){1,3}\.([0-9]){1,3}\.([0-9]){1,3}\/[0-9]{1,2}$/)]).
I also attempted to use Validators.compose()
, but it did not work. Is there another solution to achieve this?