I am trying to create a regex that will match the begining of my string in few alternatives.
- If the whole string contains no
/
then match^[a-zA-Z\-]
- If the string contains
/
then match^[\w]
until the first occurence of/
examples:
__Gi0__/0/0/0
__BVI__10
The match needs to be returned so I want to wrap it in ()
I have tried these
([a-zA-Z]+)|([\-\w]{2,}/)
but it doesnt match second case.
Any suggestions?
My awk version is GNU Awk 4.0.0