Get specific range with regex within string
REGEX:
-(.*).......:
DATA
SRV-srvdata-q_SRV_20:DAT
SRV-srvdata-p:DAT
OUTPUT
hoinvap01-q
hoha
GOAL
srvdata-q
srvdata-p
You want to match any 1+ chars from the first hyphen to the first _ or :.
You may use
-([^:_]+)
See the regex demo
The [^:_]+ will match any 1+ chars other than : and _.
-([^:_]+)