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
4
votes
1 answer
Nginx 404 for css js files
I can't load css and js files on my MAC. I get 404 for those files. on Ubuntu in nginx.conf I just add on the end rewrite ^/assets/([a-z\-]+)-([a-z0-9]+).(css|js) /assets/$1.$3; and it works.
But I don't know where put it on osx because when I wrote…

RobDee
- 145
- 2
- 3
- 6
4
votes
2 answers
SELinux file path context not working with regex
I've reformatted for readability based on suggestions in the comments.
I have a RADIUS server that uses google authenticator, and SELinux is blocking RADIUS from accessing the .google_authenticator files in the user home directories (these are also…

Taywee
- 43
- 1
- 6
4
votes
1 answer
fail2ban: regex to block \x00 requests?
Every once in a while my server goes down, and when I check my nginx logs, I usually see something like this:
78.37.54.31 - - [20/Apr/2016:20:58:51 +0300]…

Isa Hassen
- 141
- 1
- 4
4
votes
1 answer
Block specific URL in HAProxy / url-encoding
I'm trying to restrict access to a specific URL. It should not allowed to access /admin.php.
frontend example
acl restricted_page path_beg -i /admin\.php
http-request deny if restricted_page
This works fine, HAProxy is blocking access to this…
user336399
4
votes
2 answers
Writing a fail2ban multiline regex
I've got some troublesome hosts trying it on with an SSH server I run, and I'm trying to ban them using fail2ban. Problem is, I haven't done much work with regexes, and even less with Python regexes.
Here are the troublesome lines in my…

ticktockhouse
- 731
- 1
- 10
- 18
4
votes
0 answers
Unable to match expression inside If directive no matter what
I have been trying for the past 3 hours trying to match an if statement to define a variable within httpd.conf with no success:
Define test_value "A"
Define test_value "B"
I have tried:

Question Overflow
- 2,103
- 7
- 30
- 45
4
votes
1 answer
Apache LocationMatch regex behaviour does not seem correct
I am using the LocationMatch directive to set headers upon matching of certain URL patterns:
# 1
# Expected matches: //mysite.com/any-page-with-at-least-a-character-and-no-dot
Header set X-Intelligence…

Question Overflow
- 2,103
- 7
- 30
- 45
4
votes
1 answer
nginx return 301 / redirect
among all 'redirect in nginx' questions I couldn't find how to redirect (using return 301 and better no ifs) using regexps.
I have a link to my website and I'd like to remove parameter a the end:
domain.com/article/some-sluggish-link/?report=1 …

ppp
- 41
- 1
- 3
4
votes
4 answers
Sieve: filter subject with regex, file into mailbox named match
I am trying to filter mails by subject with a regular expression.
The subjects I want to match are read like [git-foo] some more text where foo is the string I want to check for.
I end up with the following
require ["fileinto", "variables",…

Jan
- 276
- 1
- 3
- 6
4
votes
1 answer
Apache MatchRedirect exception regex
I want to redirect any URL that is Https and hasn't start with "system_" to the same URL with http.
for exapmle for this url :
https://exsite.tld/some/thing/that/not/start/with/pattern
to…

Arash Mousavi
- 678
- 3
- 8
- 21
4
votes
1 answer
pcregrep is not matching regex (multiline?)
I don't understand why is first two is a match/hit, yet third is a miss?
-bash-3.2# cat 1361492805.M171838P41834.mx1.alexus.biz\,S\=12921\:2\,Sijm | pcregrep -q '.*languager.*' ; echo $?
0
-bash-3.2# cat…

alexus
- 13,112
- 32
- 117
- 174
4
votes
1 answer
nginx: [emerg] unknown "script_filename" variable
I'm receving this error when trying to use script_filename
nginx: [emerg] unknown "script_filename" variable
nginx: configuration file /etc/nginx/nginx.conf test failed
However script_filename is defined in : fastcgi_params
fastcgi_param …

Linux Intel
- 183
- 2
- 3
- 16
4
votes
2 answers
Postfix virtual domains: how to accept all subdomains except for two?
Assuming my Postfix server serves the domain example.com, I want it to accept mail for all the subdomains of example.com except for mail.example.com and in.example.com.
At first I've tried using a regular expression that excludes these two…

arikfr
- 369
- 2
- 5
- 16
4
votes
2 answers
Why does a $1 backreference work in a rewrite with no subgroups?
Someone I'm working with committed a RewriteRule such as the following to SVN:
RewriteRule ^admin/ebay.*$ /yii.php/$1 [L]
I warned him that it may not work because there is no subgroup in the match that would correspond to the $1 backreference. It…

Ezekiel Victor
- 171
- 7
3
votes
1 answer
How to create a regular expression for an openvpn fail2ban filter
Some people are trying to get into my openvpn server. For now I'm manually banning each IPs because I don't know how to setup a fail2ban regex. The content below is basically what is found in my /var/log/syslog
Jun 18 19:57:01 Server…

answerSeeker
- 153
- 1
- 9