Hello good afternoon!!
I'm new to the world of regular expressions and would like some help creating the following expression!
I have a query that returns the following values:
caixa-pod
config-pod
consultas-pod
entregas-pod
monitoramento-pod
vendas-pod
I would like the results to be presented as follows:
caixa
config
consultas
entregas
monitoramento
vendas
In this case, it would exclude the word "-pod" from each value.
CodePudding user response:
I would try (.*)-pod
. It is not clear, where do you want to use that regexp (so regexp can be different). I guess it is dashboard variable.
CodePudding user response:
You can try
\b[a-z]*(?=-pod)\b
This regex basically tells the regex engine to match
\b
a word boundary[a-z]*
any number of lowercase characters in rangea-z
(feel free to extend to whatever is needed e.g.[a-zA-Z0-9]
matches all alphanumeric characters)(?=-pod)
followed by-pod
but exclude that from the result (positive lookahead)\b
another word boundary
\b
matches a word boundary position between a word character and non-word character or position (start / end of string).