How to use regexp validator in array type Smart variable

I have a Smart variable or array type. I am trying to add a regexp
validator rule. No matter what I put in the validator rule text box Foreman
says all of my values "is invalid".

Even the simplest .* gives this error.

What am I missing here?

I have tried looking for an example of expected input to the validator rule
box but have not been able to find any examples.

Ian,

we are using the standard Ruby regular expressions here:

def validate_regexp
return true unless (validator_type == 'regexp')
errors.add(:default_value, _("is invalid")) and return false unless (default_value =~ /#{validator_rule}/)
end

The default value should match your regexp. You can test them in Ruby
itself:

irb

"value" =~ /val[uU]e/

LZ

··· On Tue, Dec 10, 2013 at 11:59:48AM -0800, Ian Tewksbury wrote: > I have a Smart variable or array type. I am trying to add a regexp > validator rule. No matter what I put in the validator rule text box Foreman > says all of my values "is invalid". > > Even the simplest .* gives this error. > > What am I missing here? > > I have tried looking for an example of expected input to the validator rule > box but have not been able to find any examples. > > -- > You received this message because you are subscribed to the Google Groups "Foreman users" group. > To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+unsubscribe@googlegroups.com. > To post to this group, send email to foreman-users@googlegroups.com. > Visit this group at http://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/groups/opt_out.


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman