diff options
author | Zhiming Wang <zmwangx@gmail.com> | 2016-01-08 11:21:54 -0800 |
---|---|---|
committer | Zhiming Wang <zmwangx@gmail.com> | 2016-01-08 11:21:54 -0800 |
commit | 6053d313ce3abe876c7d05574effab438ce5e410 (patch) | |
tree | 0ff96b8118d625e57123a42e6582b9f0e0575583 /source/blog/2015-12-20-regex-flavor-hell.md | |
parent | d484ca3946753a6dda8f37bb3a2529fc06294fc5 (diff) | |
download | my_new_personal_website-6053d313ce3abe876c7d05574effab438ce5e410.tar.xz my_new_personal_website-6053d313ce3abe876c7d05574effab438ce5e410.zip |
Markdown source files: Use ... to end YAML metadata block
Also add a newline after the metadata block.
... is easier on markdown-mode; if --- is used, the line immediately
above it will be treated as a setext header and highlighted, which isn't
so easy on the eyes.
Diffstat (limited to 'source/blog/2015-12-20-regex-flavor-hell.md')
-rw-r--r-- | source/blog/2015-12-20-regex-flavor-hell.md | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blog/2015-12-20-regex-flavor-hell.md b/source/blog/2015-12-20-regex-flavor-hell.md index 6895299f..15488655 100644 --- a/source/blog/2015-12-20-regex-flavor-hell.md +++ b/source/blog/2015-12-20-regex-flavor-hell.md @@ -2,7 +2,8 @@ title: "Regex flavor hell" date: 2015-12-20T16:03:03-08:00 date_display: December 20, 2015 ---- +... + I write a lot of shell scripts, which means dealing with common *ix utilities a lot. I typically want my scripts to work on both OS X and Linux (or OS X + GNU utilities, which is my personal setup), which means writing commands that are understood in both GNU/Linux and BSD worlds. Unfortunately that's not so simple, because to do that I usually have to give up readily available functionalities (especially the vast collection of useful options typical of GNU utilities) and am constantly thrown back to the stone age that is POSIX, or a little bit more than POSIX. Working with regular expressions is especially painful. Almost every implementation of every utility (with regex support) has its own flavor of regex. Most notably the big three: `grep`, `sed` and `awk`. GNU utilities of course come with GNU extensions, but they are nothing when aiming for compatibility. Ignoring GNU extensions, there's a way to turn on standard POSIX extensions (ERE) on `sed`, but unfortunately GNU and BSD use different flags: `-r` for GNU sed and `-E` for BSD sed. The two implementations of `grep` thankfully use the same flag `-E` to turn on ERE, but GNU grep, being a GNU utility and having to distinguish itself from its mundane counterpart, further implements `-P,--perl-regexp` — regexers' dream. It's there but I can't use it, except in an interactive shell. `awk` has more than two implementations and will be left out of this discussion. |