Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
r"
(.*\/).*
"
gm
Input 1
1
New
# Remove file name from path # I just want to keep the directory the file is in ../data/detect_5wk.csv ../data/detect_5wk.nb.html # This means that I will have to do a substitution in R # stringr::str_replace("../data/detect_5wk.csv", "(.*\\/).*", "\\1")
Substitution
\1
# Remove file name from path # I just want to keep the directory the file is in ../data/detect_5wk.csv ../data/detect_5wk.nb.html # This means that I will have to do a substitution in R # stringr::str_replace("../data/detect_5wk.csv", "(.*\\/).*", "\\1")