In angular version: 2.1.1, I've create a form with form builder, one controller is for inputting coordinates (latlng) from google maps. I've defined the coordinates format with regex as:
- (-?\d+(.\d+)?),\s*(-?\d+(.\d+)?)
Thus a valid string would be:
- 2.3, 4.66
I've set my validator as:
this.addressForm = this.formBuilder.group({
"geoLocationLatLng":[null, [
Validators.required,
Validators.maxLength(150),
Validators.pattern("(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)")]],
});
Question, why is pattern validation not working?