|
Extract everything before a regex match
Hi, say i had a string
"VALUE1 VALUE2 VALUE3 ID266PC32 VALUE5 Value6"
im having a bit of trouble on how i can extract value1 value2 value3 - before a regex match of ID[0-9][0-9][0-9]PC[0-9][0-9]
Doing:
echo `expr match "$testa" '.*\(ID[0-9][0-9][0-9]PC[0-9][0-9]*\)'`
will result in returning ID266PC32 - but im confused as to how i can extract everything before that - especially since there may be x values before that regex match.
Thanks.
|