52
If you create a man page
(lemmy.zip)
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
I believe you but in the spirit of regex, can you explain?
I guess hyphen is literal outside of square brackets. But then you’re escaping an angle bracket?
Also curious what trouble OP was having. Wouldn’t a trailing space be enough?
‘/-o ‘
The problem is that
/-owill also match something like--my-irrelevant-option.Word boundaries match the end (or the beginning) of the word.
How exactly to do it depends on the regex library, my
lessis built withPCRE2therefore I can do/-o\b.It depends on how the document is written, but \> stops matching on a period, comma, apostrophe, space, newline, what have you. Word boundary matching is just very handy.
As to why its that set of characters.... Honestly I have no idea :) Regexes are just what they are and I assume the special escape made sense to the inventor at least.
Dealing with multiple more complex tools the last few days, looking the short option up, because i needed to know what it does, was about a hundred steps through walls of text. Then came the yay and curl manpages; one or two steps. That's when i wrote the post.