Regex of the week
Posted by mholmes on 01 Dec 2011 in Activity log
Wrote and tested JavaScript regex to constrain input in integer fields, allowing greater-than and less-than:
/^((([\s]*[<]{1,1}[\s]*[-+]{0,1}[\d]+[\s]*[>]{1,1}[\s]*[-+]{0,1}[\d]+[\s]*)|([\s]*[>]{1,1}[\s]*[-+]{0,1}[\d]+[\s]*[<]{0,1}[\s]*[-+]{0,1}[\d]+[\s]*))|([\s]*[<>]{0,1}[\s]*[-+]{0,1}[\d]+[\s]*))$/
Added this validation to the JS code, and also updated the search output to include validation (it was missing for some reason; only previously included in data-entry form).