17 private links
my ($relpath) = $abspath =~ m#/var/ftp/(.*)$#;
fd is a simple, fast and user-friendly alternative to
find.
While it does not seek to mirror all of find's powerful functionality, it provides sensible
(opinionated) defaults for 80% of the use cases.
Features
- Convenient syntax:
fd PATTERN
instead offind -iname '*PATTERN*'
. - Colorized terminal output (similar to ls).
- It's fast (see benchmarks below).
- Smart case: the search is case-insensitive by default. It switches to
case-sensitive if the pattern contains an uppercase
character*. - Ignores hidden directories and files, by default.
- Ignores patterns from your
.gitignore
, by default. - Regular expressions.
- Unicode-awareness.
- The command name is 50% shorter* than
find
:-). - Parallel command execution with a syntax similar to GNU Parallel.
app.get('/:var(bla|blabla)?', todo)
:var
sets the req.param
that you don't use. it's only used in this case to set the regex.
(bla|blabla)
sets the regex to match, so it matches the strings bla
and blablah
.
?
makes the entire regex optional, so it matches /
as well.
<Route path="/:path(path1|path2)" component={MyComp} />
sed
is stream editor, but can edit files directly too, with the following:
sed -i -e 's/foo/bar/g' filename
s
is used to replace the found expression "foo" with "bar"
g
stands for "global", meaning to do this for the whole line. If you leave off the g
and "foo" appears twice on the same line, only the first "foo" is changed to "bar".
-i
option is used to edit in place on filename.
-e
option indicates a command to run.
3.1.2. Complete Expression for Deliverable Email Address
The following regular expression is a deliverable email address:
; Mailbox from RFC 5321, as amended
P E J DEA = ([A-Za-z0-9!#-'*+\-/=?^_`{-~\xA0-\x{10FFFF}]+
(?:\.[A-Za-z0-9!#-'*+\-/=?^_`{-~\xA0-\x{10FFFF}])|
"(?:[ !#-\[\]-~\xA0-\x{10FFFF}]|\\[ -~])*")@
((?:[A-Za-z0-9](https:///?:[A-Za-z0-9\-]*[A-Za-z0-9])?|
[\x00-\x{10FFFF}]*[\x80-\x{10FFFF}]+[\x00-\x{10FFFF}]*)
(?:\.(?:[A-Za-z0-9](https:///?:[A-Za-z0-9\-]*
[A-Za-z0-9])?|[\x00-\x{10FFFF}]*
[\x80-\x{10FFFF}]+[\x00-\x{10FFFF}]*))*)
In the regular expression DEA, capturing group 1 is the local-part
production, and capturing group 2 is the domain production.
It's an interesting dilemma. There are two obstacles to doing this in sed. One is that sed operates line by line and never sees the newline endings. Second, sed's regular expressions don't provide a way to exactly match a newline character.
If you really want to do this, don't use sed; use tr.
cat file | tr '\n' ','