When asking regex questions, always add the tag for the specific programming language or tool (e.g., Perl, Python, or Java; vi, emacs, or ɢɴᴜ grep; etc.) you are using.
Questions tagged [regex]
720 questions
0
votes
3 answers
rsync just thumbnail.jpg and leaving the rest
I have a large directory tree with lot of files like;
/abc2/def/thumbnail.jpg
/abc1/def/thumbnail.jpg
/abc1/def/geh/someothertextfile.txt
/abc1/defe/geh/thumbnail.jpg
I would like to rsync all those directories and files that match thumbnail.jpg to…

Tom
- 11,176
- 5
- 41
- 63
0
votes
1 answer
Nginx -> rewrite ordering or nesting
I'm working on a new top-level domain, and redirect visitors of the new domain to the old one, except for my own work on the staging server:
I have a rule that rewrites the host if you don't hit the staging server, which works like a bomb.
if ($host…

rdrey
- 103
- 5
0
votes
2 answers
How can I exclude a file in a folder from basic auth (regex help)?
I have a folder on my site which contains admin files and I've added basic auth following a little unwanted attention. This works fine however a couple of the admin functions won't work through basic auth as they handle file uploads and so I want…

simon180
- 103
- 4
0
votes
2 answers
test filenames for regex patterns in bash
I'm not sure exactly how the code should be written but I want to test a file/folder for naming patterns, something like:
if [ -d $i ] && [ regex([0-9].,$i) {
do something
}
I want it to check if the file/folder is a directory and that…
rk
0
votes
1 answer
Fail2ban apache2 access log regex
Can anyone help me with fail2ban regex
My goal is to ban any accessing .env or .php files or any request that starts with "wp-", it is a little bit confusing
and another to detect invalid request methods like someone trying to connect from…

Joukhar
- 103
- 3
0
votes
0 answers
Using Rank Math REgex for subfolder redirects to home
So short summary: im a SEO specialist working on a website that has over 1000 404 pages due to a translator app. The subfolders /de/ /fr/ /es/ /en/ and URL's within the subfolder need to be redirected to the homepage. Because it is not possible to…
0
votes
1 answer
Regular expression does not work in EMEditor
I have a simple Regular expression to select all text between X-Mozilla-Status and [Chat Info]. I tried it at https://regexr.com/, and it all works great. However, it can't find anything if I add it to the find area in EMEditor and search my…

TAPIO
- 1
0
votes
1 answer
Can't get Samba smv.conf shadow copy snapprefix to recognise snaps
I'm really with this one. What I'm aiming for is that snpshots with an optional tag at the front, as well as untagged snaps are seen in windows as previous copies, e.g. file names such…

Arthur Mitchell
- 1
- 2
0
votes
2 answers
Unable to compile regular expression in Fail2Ban
I'm trying to get this regex working in Fail2Ban:
SRC=(?.*) DST.*(?=DPT=5003)
In a regex tester it's working very fine. When testing in Fail2Ban, I get this error:
ERROR: Unable to compile regular expression…

error401
- 23
- 1
- 4
0
votes
1 answer
linux fail2ban not catching auth a specific fail with postfix
I had journalctl open and noticed an offender repeatedly hitting me with auth fails in postfix. I have a standard postfix-sasl filter on by default that, to my knowledge, is working well.
It wasn't catching this one offender, of course my curiosity…

gstlouis
- 119
- 3
- 12
0
votes
0 answers
NGINX - How to serve file with filename that begins with the last segment of uri?
I have many PDFs in a \drawings folder on my server. The filename structure is: 8 digits, underscore, Rev level letter -- i.e. \d{8}_[A-Za-z]\.pdf. These files are organized in subfolders that match the first 4 digits of the filename --…

Sean O
- 277
- 4
- 5
- 16
0
votes
0 answers
fail2ban block plex failed login attempts
I want to ban IPs who attempt to authenticate against my public Plex instance.
Im on Ubuntu and the log Im looking at is the following:
/var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Logs/Plex\ Media\…

Deac Karns
- 101
- 2
0
votes
0 answers
regex puppet query syntax
I'm trying to learn how to use puppet query, but I'm finding it difficult to target a particular fact path using regex.
If I use the following query, I get exactly what I'm looking for:
puppet-query 'inventory[certname, facts.os.family,…

sutur
- 1
0
votes
1 answer
NGINX reverse_proxy with subpath and regex
I have a site running on localhost:8001 and I would like it to be accessible on different paths. I need to extract part of the path using regex.
This does work:
server {
location /user/amy/ {
proxy_pass http://localhost:8001/;
…

Shai
- 101
0
votes
1 answer
How to make an regex in Fail2ban with ip:port
First of all, English is not mu native language, so if I make a mistake don't shoot me. :)
Here's my problem: when I use every thing works fine, as soon as there is a port number or a comma direct after the IP-address is involved, it never has a…

Storm
- 1
- 1