No, that will most likely give us an empty string. Consider the anatomy of a data group:
ltm data-group internal /Common/d_group {
records {
string_1 {
data value_1
}
string_2 {
data value_2
}
}
type string
}
In this example string_1 and string_2 are the strings with which we can in different ways match other strings. Furthermore, value_1 and value_2 are the values corresponding to string_1 and string_2 respectively and are an optional part of the data-group record. Normally 'class match' will give you the result 1 if there is a match in the data-group and 0 if there aren't any matches, but the option '-value' will return the value instead of 1 or 0. But since your data-group in your second example doesn't have any values associated with the strings using that option will give us an empty string or possibly cause an error.
So given your requirement I think you would want an iRule that looks something like this:
when HTTP_REQUEST {
if { [class match [HTTP::host] equals testssl-ma] }{
}
else {
reject
}
}
So if someone connects to the site using either hostname amit.amit.com.au or abcd.abc.com.au the code of your choice will be executed since the 'class match' will return 1 which equals to 'true' in programming (whereas 0 is false), otherwise the traffic will be rejected.
Is that what you're looking for?
Also consider the 'string tolower' command that evaluates the string as if it was all lower-case, because in the above example using hostname amit.amit.com.au would give us a match but AMIT.amit.com.au wouldn't. So using on the HTTP::host would look like this:
[string tolower [HTTP::host]]