I'm using 1000hz Bootstrap Validator to validate fields within my contact form. I'm using data-pattern
on an email field to make sure the format is correct.
"data-pattern" => "myemailregexpattern"
I want to write a data-pattern validation where I don't allow email addresses or URLs in a single text field.
I'm programming in Ruby and normally would write logic like the following to validate a text field outside of the form.
if params[:message] =~ /myemailregexpattern/i || params[:message] =~ /myurlregexpattern/
display error message
Basically I want to do something like the following where it will identify a field value as valid if matches are not found for both regex patterns.
"data-pattern" => "**--negate--**myemailregexpattern**--and---**myurlregexpattern"
OR
"data-pattern" => "**--negate--**((myemailregexpattern)|(myurlregexpattern))"
After reading multiple posts here and on several suggested reference blogs and websites I have not found any examples where an entire regex is negated. I thought I might be able to use a lookaround but it was not clear if it would work or how to write the regex.