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.

learn more… | top users | synonyms (1)

0
votes
1answer
26 views

sudo : wildcard in user/group name

I try to find a solution about a sudo problem. I need to push different sudoers files on different servers, depending on the users present on the servers. But I would like to know if I can avoid that ...
1
vote
0answers
32 views

nginx subdirectory to subdomain icingaweb2

I currently have icinga2 set up with the new icingaweb2 ui. it defaults to the subfolder /icingaweb as follows: location ~ ^/icingaweb/index\.php(.*)$ { # fastcgi_pass 127.0.0.1:9000; ...
0
votes
0answers
32 views

Finding and renaming directories by regex in linux

I'm trying to match (and later rename) directory names like: A0000 (SOME-NAME) A0001 (SOME-OTHER-NAME) A0001 (ANOTHER-NAME) I'm testing to see if I match any using the find command but doesn't seem ...
1
vote
1answer
207 views

Nginx equivalent to lighttpd “evhost.path-pattern”

I'm setting up a new server for my personal stuff. On the old box I've used lighttpd for almost two years now. I've read a bit about it and most people tend to switch to nginx since it's development ...
0
votes
2answers
2k views

Zabbix 2.0: Regular Expression to extract value from a String for a trigger?

I am using Zabbix 2.0.4 to monitor several Java applications. Most values are exported via JMX. One of those exported attributes is a string that is constructed like this: ...
0
votes
1answer
361 views

Pop-before-smtp $pat regex for Dovecot in iRedmail

I've installed pop-before-smtp in my mail server(iredmail). I need help to configure the $pat to read the pattern of my Dovecot file. Dovecote log file is like this: 2011-05-14 14:01:21 pop3-login: ...
0
votes
1answer
46 views

Apache 2.4 AliasMatch NotWorking

I used to Alias have as below for /CollabPortal14300 which was working fine Alias /CollabPortal14300 D:/Dev/Projects/CollabPortal/CollabPortal/target/CollabPortal/ Alias ...
0
votes
1answer
26 views

Fail2Ban: I'm having trouble creating a regex for my Dovecot filter

I am trying to create a regex filter for my failed Dovecot entries in the maillog file. What I have created is: .*dovecot: auth: sql\(.*,<HOST>\): Password mismatch The target line in the ...
0
votes
0answers
8 views

Fail2ban apache-myadmin regex

I've got a jail set up with the following regex, which I took from a standard filter file: apache-myadmin.conf failregex = ^[[]client <HOST>[]] File does not exist: *myadmin* *\s*$ ...
1
vote
1answer
111 views

Show real server name in nginx logs and params passed to fastcgi?

I have configured my nginx vhosts with a regex in server_name. nginx shows the raw regex in logs and in params passed to php-fpm (I know there's $_SERVER['HTTP_HOST'] with a real value, that's not an ...
0
votes
2answers
929 views

apache - query string rewrite rule appends condition to URL

In trying to rewrite site-search.html?searchword=search%20term as advanced-search#q=search%20term I always end up with advanced-search#q=%3Fsearchword%3search%20term The %3Fsearchword%3 ...
0
votes
1answer
32 views

nginx location regex /yyyy/mm/dd/

I'm trying to pass requests from address example.com/donor/2014/12/07/Name on the other server. URIs are like /donor/2014/12/07/Mike and I need to convert them to a query type of: ...
2
votes
1answer
1k views

nginx regex characters that require quoting?

So I was configuring nginx today and I hit a weird problem. I was trying to match a location like this: location ~ ^/([0-9]+)/(.*) { # do proxy redirects } ...for URLs like ...
1
vote
2answers
40 views

Nginx location regex doesn't work with proxy pass

I'm trying to get these 2 location directives working in Nginx but I'm getting some errors back when booting Nginx. location ~ ^/smx/(test|production) { proxy_pass ...
0
votes
1answer
56 views

Postfix body_checks regexp expression does not work?

I have a a reject rule inside body_checks parameter written like this: /(\d{3,4},\d{2} EUR)/ REJECT Body Spam Rule 934 This regexp paramater should be ok, at least according to some testing pages ...
1
vote
0answers
22 views

Apache2 mod_rewrite, handling the optional “/” at the end of a URL

I am attempting to host a single custom page to set as my homepage on my server. The real path to the page is example.com/start.html. However, I do not want this ugly URL in my homepage so I am ...
12
votes
1answer
130 views

How do I make sec ignore a timestamp properly

I have a rule that is set up like so; In /etc/sec/rules.d I have; type=SingleWithSuppress ptype=regexp pattern=(\S+) sshd\[\d+\]: PAM \d+ more authentication failures\; logname=.* uid=.* euid=.* ...
0
votes
1answer
41 views

nginx location regex match everything but home

I am trying to restrict access to everything but home "/". I mean: allow people to access example.com but restrict access with password to any other path: example.com/any-other-path. I have tried ...
4
votes
3answers
5k views

Regex for sed to grab multiple lines or a better way?

I'm creating a script that connects to a server and dumps the output to a tempfile. I want to use sed in the script to grab specific information from the temp file. The output would always have the 80 ...
0
votes
0answers
23 views

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. ...
2
votes
1answer
1k views

nginx return 301 / redirect

among all 'redirect in nginx' questions I couldnt find how to redirect (using return 301 and beteer no ifs) using regexps. I have a link to my website and I'd like to remove parameter a the end: ...
0
votes
1answer
44 views

How to update multiple registry key values using regex?

I am looking for a way to use regex in reg add command in order to update multiple registry key values. Is there any way to do this? reg add "HKEY_USERS\.DEFAULTS\Control Panel\Desktop" /v ...
0
votes
1answer
2k views

Nginx match multiple paths in location directive

I have the following directives in my nginx conf, that are working correctly: location = /favicon.ico { root /home/www/myapp/static/ico; } location ^~ /apple-touch-icon { root ...
2
votes
1answer
6k views

Nginx location regex is not matching

The following has been working to cache css and js for me: location ~ "^(.*)\.(min.)?(css|js)$" { expires max; } results: $ curl -I http://mysite.com/test.css HTTP/1.1 200 OK Server: nginx ...
2
votes
3answers
238 views

How do I find this string?

I'm trying to match these file names with the find command: 4702011-10-21CR719557-R85262-ALPHA.jar 4702011-10-21CR719557-R85262-BETA.jar I'm reasonable familiar with Java-Perl regex syntax. ...
0
votes
1answer
58 views

How to remove language part of $uri for purpose of try_files in nginx 1.6?

I have a site with language prefixes in $uri, for example: http://www.example.com/en/some/content http://www.example.com/ru/novost Sadly, due to limitations of framework I'm using, files are also ...
1
vote
1answer
56 views

mod_pagespeed ModPagespeedLoadFromFile ReGex not working

I have following directive in MPS config: ModPagespeedLoadFromFile "^https?://www.(e|i)zi?aro(v|w)k(y|i).(cz|sk|pl)/static/" "/var/www/eZarovky/production/public/static/" This RegExp should match ...
1
vote
1answer
97 views

Postfix bad notify parameter syntax

Please bear with me as I'm not an expert admin I have a linux mail server that has been running for a couple of years and now all of a sudden a certain user is unable to send emails. They immediately ...
0
votes
0answers
41 views

Regex validation : simple hotlink prevention while allowing search engines (and their localized versions)

I made and tested a simple hotlink prevention .htaccess and wanted to validate it here before putting it in production. <IfModule mod_setenvif.c> SetEnvIf Referer mysite\.com|localhost ...
0
votes
1answer
19 views

Varnish 3 ignore the req.backend directive

Varnish3 is ignoring the req.backend directive. As explained on the documentation (here), I've set two backends, and the regex for redirecting the request to the correct one. By the way, seems liks ...
0
votes
1answer
792 views

Is it possible to match more than one regular expression with a single <ProxyMatch> rule?

I have a production, testing, and development server for a site that I maintain. All three servers are running Apache 2.2.16 on Debian 6 GNU/Linux. I have set up a new version of our company site on ...
0
votes
2answers
2k views

nginx simple regex location

I need to set a location param in nginx if the first 5 digits of the url are numbers. site.com/12345/ or site.com/12345 But I can't for the life of me seem to get the correct regular expression. ...
0
votes
0answers
38 views

php-fpm: Maintain php_mod logging format

I recently switched all my lab servers from apache pre_fork/mod_php to apache worker/fcgi/php-fpm, and after getting everything set-up correctly, I noticed one last issue; php-fpm is adding it's own ...
1
vote
1answer
135 views

Trouble with Fail2Ban UFW Portscan Filter

I'm trying to create a filter for fail2ban that recognises port scans in the UFW logs. I've confirmed my ban action is working correctly on other filters and am having trouble creating the correct ...
0
votes
0answers
7 views

mod_rewrite: Use Substitution from Previous Condition

I'm trying to do a basic language redirect based on a cookie. To do that and prevent a loop, I need to check that the user isn't already on the correct URL, so I wrote this rule: RewriteCond ...
1
vote
1answer
59 views

Regex matching first word and any word

I have a log file with a list of many entries. With grep regex I want to match the first word and another word which can be anywhere in the string. For example, if I specified "user1" the search ...
0
votes
3answers
65 views

Tinydns data file change ip with bash

I am using tinydns and need to dynamicly change some ip in data file. I want to use bash script for it. For example data file: +sub1.example.org:282.196.222.245:14400 ...
2
votes
2answers
233 views

nginx rewrite regex for API versioning

What I want is for the first to be turned into the second.. /widget => /widget/index.php /widget/ => /widget/index.php /widget?act=list => ...
0
votes
1answer
51 views

nginx regex configuration for 404 images

I have dynamic link series like below; http://example.com/users/1871233/18712443_cover.jpg Only static thing is on that link is example.com/users and _cover.I want to make that ; when requested is ...
1
vote
3answers
3k views

apache locationmatch negative regex

I'm trying to expose a location through Apache. Normally, I have this block in my vhost that says <Location /> AuthType Basic AuthUserFile /web/.htpasswd AuthName "Test Site" ...
-2
votes
1answer
33 views

zsh substitution, can't do regex with repetition

I'm trying to perform ZSH variable substitution, but I'm having to do it the lame way, by piping through cut. Is it possible to perform this operation entirely within ZSH? ...
0
votes
0answers
96 views

Graylog2 date extractor from tab-delimited file

I have a tab-delimited logs with such messages: 2014-06-01 00:00:56 192.168.1.1 968 http://yandex.ru I can extract date and time with regexp (\d{4}-\d{2}-\d{2}\s*\d{2}:\d{2}:\d{2}) but when I ...
0
votes
1answer
228 views

Regex matching specific details if first match exists, multiline

I'm struggling to get the correct regex to match specifically 'Contact' and 'User-Agent' only if the 'Contact' address matches 10.0.x.x in ~70GB of SIP messages. The SIP message will always contain a ...
0
votes
2answers
3k views

Make exception to whole-site RedirectMatch rule

We have this RedirectMatch rule to move clients on the SSL enabled site while maintaining the path they're trying to access: Redirectmatch permanent (.*) https://www.foobar.com$1 and it is working ...
1
vote
1answer
120 views

Nagios plugin check_snmp_int does not match regular expression

I am using nagios plugin check_snmp_int with -n switch. Help show: -n, --name=NAME Name in description OID (eth0, ppp0 ...). This is treated as a regexp : -n eth will match eth0,eth1,... ...
1
vote
1answer
232 views

How to make comments in logcheck files?

how can I add comments to logcheck ignore-rules? Things I tried so far: # seems to match single # characters instead of starting a comment empty lines matches against everything $ matches against ...
0
votes
1answer
77 views

Matching %ff in Nginx rewrite rules

I have some dubious requests coming into my server that contain %ff and %FF (e.g., /blog/%ffupdates/. I'm getting thousands of these daily and would like to start redirecting them to a 403. I ...
0
votes
2answers
90 views

How to print regex match

My problme is two fold. First is printing a regex match. The second is the actual regex. Problem 1: I'm trying to print the output of yum grouplist --verbose into a format that I can put into a ...
0
votes
1answer
162 views

apache - query string rewrite rule adds percentage symbol

I've set up a rule to rewrite a query string. Although the redirection is correctly performed, a % character is appended to the rewritten query portion of the URL, like so: ...
1
vote
0answers
23 views

SED returning error 2 when launched by Wpkg

Case I am deploying a software product using Wpkg over Windows workstations. I need to disable product's faulty automatic update and the best solution in this case is to modify one configuration file ...