I'm studying Regex and I faced a example that convertes dates formats:
sed -r 's|([0-9]{2})/([0-9]{2})/([0-9]{4})|\3/\2/\1|' <<< 05/04/1947
Output:
1947/04/05
I understand why this works but I'm not sure why the author used |
'pipe' instead of '/' to separate the regexp, replacement and flags sections.
I think changing |
to /
would make the same output:
sed -r 's/([0-9]{2})/([0-9]{2})/([0-9]{4})/\3/\2/\1/' <<< 05/04/1947
Why the last example does not work like the first one?
Thanks!