what is the {format as a regular expression} for {red} has {short name} as {R} ?
Is R the format for a regular expression of red?
Is the format for regular expression for red, R?
SELECT ?d WHERE { ?z property:short_name ?w . ?z property:format_as_a_regular_expression ?d . FILTER ( CONTAINS ( ?w , 'R' ) ) . resource:red property:short_name ?z }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q3142> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P1813> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <R> .
?statement <http://www.wikidata.org/entity/P1793> ?value. 
} 

SELECT ?value WHERE { wd:Q3142 p:P1813 ?s . ?s ps:P1813 ?x filter(contains(?x , 'R')) . ?s pq:P1793 ?value}