Thanks a ton.
I thought myself to be good with regular expressions, probably time to change it
Let's assume below stands true:
Quote:
The behavior of multiple adjacent duplication symbols ( '+', '*', '?', and intervals) produces undefined results.
echo a/b/c+ | awk -F'/b/c+' '{print $1, $2}'
a +
Quote:
c+ matches one or more occurrences of 'c'. + comes as second field
echo a/b/c | awk -F'/b/c+' '{print $1, $2}'
a
Quote:
We don't have a second field here
Request your thoughts on why the below doesn't match when we have a $:
echo a/b/c+ | awk -F'/b/c+$' '{print $1, $2}'
a/b/c+
Quote:
Here is my reasoning, please correct
c+ matches a/b/c.
$ makes it to think that it's the end of line, but it isn't as we have an additional + after that.
Hence, it doesn't qualify for a match & fails.