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
1 answer
How do I format this to regex to be matched in Fail2Ban?
I am building a regex-filter to work with this log file:
[15:20:56|9M] 191.241.67.46 | fordcom2002 | delphina | /login
[15:20:56|9M] 109.167.249.41 | kyler394 | Baseball1 | /login
[15:20:57|9M] 103.112.62.126 | akuztikkaren | docomo |…

Christian Noel
- 129
- 9
0
votes
1 answer
Nginx restrict access to files in a directory but not in subdirectories
I implemented Nginx secure link module but can not get it working. I did read many posts on Serverfaulty and Stackowerflow but no success.
I want to restrict access to any full size /image/video files in…

Tfsur
- 3
- 1
- 2
0
votes
1 answer
NGINX regex get full url with everything except last forward-slash and query string
UPDATE:
The solution in my case was this:
map $http_host$request_uri $pageCache {
default "nonexistent";
"~^(?.{4})(?.*)\.example\.com(?.*?)\/?(\?.*)?$"…

NAMAssist
- 125
- 9
0
votes
1 answer
NGINX Clean URL ReWrites. How?
I have spent several hours trying to figure out in NGINX what is otherwise and incredibly trivial task in Apache.
I am exhausted...
I have installed NGINX right out of the box.
html is the root folder.
I
JSON Internal…

suchislife
- 356
- 4
- 11
0
votes
0 answers
NGINX Location Wildcard/Regex Not Working
I've tried countless wildcard/regex combinations to no avail for the below code. Basically just want it to capture any sub-directory of the /protected/ folder. If I use the below code for a specific folder, it works, but if I try stuff like location…
0
votes
1 answer
How can I create regular expression?
I need help with regular expressions.
I have some queues in the rabbitMQ, about 1000:
ha-collector-data-test2
ha-collector-data-1434
ha-collector-data-45-test3
ha-collector-data-terty4
ha-collector-data-341
etc.
And I need to filter these queues.…

perrfect
- 65
- 1
- 7
0
votes
2 answers
Nginx Redirect - maintaining the original domain name
i have my site domain.com in one server using nginx.
Every-time that someone hit [1] example.com/~username i need that show the content of
[2] http://example2.com/~username/ that reside in other server.
But maintaining the original first domain name…

Zio Guillo
- 1
- 3
0
votes
1 answer
Htaccess: some of the parameters doesn't work with GET?
.htaccess file
RewriteEngine On
RewriteRule ^/?([a-z]+)/([a-z]+)/market/(?!.* (css|js|jpeg|jpg|JPG|png|PNG|svg|ttf|otf)).*$ external/market/index.php?param1=$1¶m2=$2¶m3=$3¶m4=$4 [L,NC,QSA]
When I use php to get the parameters,…

JustMatthew
- 101
-1
votes
1 answer
nginx URL rewriting regex when URL contains a specific word but not other
Please consider the following URLs.
https://products.example.com/family/child
https://products.example.com/products/family/child
https://products.example.com/family/children
https://products.example.com/products/family/children
Among the four, I…

Prorata
- 99
- 3
-1
votes
1 answer
acl url_regex on squid3 is not working using an online tested regular expression
I was asked to block Facebook access from 8:00am to 3:00pm for almost all users but they are bypassing the current defined rules to access the social network anyway. This is consuming a lot of our low bandwidth and we can't even work. I decided to…

ppdmartell
- 11
- 1
- 5
-1
votes
2 answers
Using NGINX for wildcard denial
I have a URL...
/index.php?option=com_docman&task=doc_download&gid= // many gid's
I want to use an NGINX location block with a wildcard to "DENY ALL" any urls containing "option=com_docman"
In various regex…

Jonathan Coe
- 391
- 1
- 3
- 11
-1
votes
3 answers
Centos find coredump files
I want to use regex to find all coredump files under a directory. The pattern of the file name is core.1234
find /public_html -type f -regextype sed -regex "core.{[0-9]+:[0-9]+}"
Please advice.

Tester
- 177
- 1
- 1
- 7
-1
votes
1 answer
Matching end of file with ansible lineinfile
I'm trying to replicate the following sed snippet in ansible's lineinfile module.
sed -i '/# The named pipe \/dev\/xconsole/,$d' /etc/rsyslog.conf
I know that I can template the file or brute force match the lines but I'd like to learn how to do…

Tim Fletcher
- 410
- 2
- 6
-1
votes
1 answer
Nmap how to split and filter this(regex)?
I think i need a regex code to filter nmap output.txt
I use a tool called: Word List Updater 2.7
so this is the output: http://pastebin.com/HwgiVHDA
I want to filter,remove duplicates and look like this, uff sorry for my bad…

johny908
- 1
-1
votes
1 answer
Nginx redirect 2 level subpaths
I have the following redirect rule:
rewrite ^/path1/(.+)$ /path1/index.php?/$1 last;
rewrite ^/path2/(.+)$ /path2/index.php?/$1 last;
rewrite ^/path3/(.+)$ /path3/index.php?/$1 last;
rewrite ^/path4/(.+)$…

ayr-ton
- 103
- 3