K
Kevin Nechodom
I am trying to format some text in the midst of a s/// substitution. I have a field that can be:
(blank)
char
char-num, char - num, char#num
num
num-num, num - num, num#num
and I want to reformat it to:
(char or num)-num
So I'm trying to match it with:
s/(\w*)(?: |-|\#)*(\w*)/$1-$2/
But when I come to the case of '632', it returns '-632' instead of '632-'. How do I change this to return '632-'? I dont' understand regex precedence here.
Thanks,
(blank)
char
char-num, char - num, char#num
num
num-num, num - num, num#num
and I want to reformat it to:
(char or num)-num
So I'm trying to match it with:
s/(\w*)(?: |-|\#)*(\w*)/$1-$2/
But when I come to the case of '632', it returns '-632' instead of '632-'. How do I change this to return '632-'? I dont' understand regex precedence here.
Thanks,