Whats the difference between sed -E and sed -e

From source code, -E is an undocumented option for compatibility with BSD sed. /* Undocumented, for compatibility with BSD sed. */ case ‘E’: case ‘r’: if (extended_regexp_flags) usage(4); extended_regexp_flags = REG_EXTENDED; break; And from manual, -E in BSD sed is used to support extended regular expressions.

Regex allow digits and a single dot

If you want to allow 1 and 1.2: (?<=^| )\d+(\.\d+)?(?=$| ) If you want to allow 1, 1.2 and .1: (?<=^| )\d+(\.\d+)?(?=$| )|(?<=^| )\.\d+(?=$| ) If you want to only allow 1.2 (only floats): (?<=^| )\d+\.\d+(?=$| ) \d allows digits (while \D allows anything but digits). (?<=^| ) checks that the number is preceded by … Read more

“UnicodeEncodeError: ‘ascii’ codec can’t encode character”

You’re trying to convert unicode to ascii in “strict” mode: >>> help(str.encode) Help on method_descriptor: encode(…) S.encode([encoding[,errors]]) -> object Encodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other … Read more