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

0
votes
1answer
12 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 ...
0
votes
0answers
15 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. ...
0
votes
0answers
24 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
24 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
48 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 ...
0
votes
1answer
17 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
0answers
36 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
0answers
34 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
106 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
6 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
46 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
1answer
46 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 ...
2
votes
2answers
180 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 => ...
-2
votes
1answer
29 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
80 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 ...
1
vote
1answer
102 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,... ...
0
votes
1answer
73 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
86 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
2answers
690 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
158 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
1answer
97 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 ...
1
vote
0answers
22 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 ...
-1
votes
2answers
189 views

Fail2Ban Regex - Joomla / PHP5-FPM

i can't get a regex for fail2ban to work. I want to match the following: [Tue Jun 24 10:22:14.528987 2014] [fcgid:warn] [pid 22526:tid 139757615011584] [client IP:PORT] mod_fcgid: stderr: user admin ...
0
votes
1answer
59 views

Postfix Regex Alias with Text Substitution

I'm migrating from an older email structure ([first letter of first name].[last name]@company.com) to [first letter of first name][last name]@company.com. To ensure that mail sent to older addresses ...
0
votes
1answer
61 views

Puppet: Nagios with regex node names

I am configuring a puppet master and want to rely heavily on hiera. Many of my systems will be almost identical due to being scalable. I have therefore created node manifests which use regex rather ...
0
votes
1answer
251 views

Optional URL segments in NGINX

I need to proxy pass multiple segments further to another server, there can be up two 5 segments. What nginx needs to match example.com/somehash example.com/somehash/segment1 ...
2
votes
2answers
3k views

nginx url rewriting. i just don't get it

Ok, an example url is http://www.mysite.com/?p=account&view=settings the p uri is a constant. all urls have it. the view is one of many optional uri. i've tried to understand url rewriting ...
0
votes
2answers
298 views

Zabbix doesn't update value from file neither with log[] nor with vfs.file.regexp[] item

I am using Zabbix 2.2. I have a very specific environment, where I have to generate desired data to file via script, then upload that file to ftp from host and download it to Zabbix server from ftp. ...
1
vote
0answers
129 views

varnish - multiple catch-all domain names

In order to avoid setting up one backed per subdomain, I am specifying a catch-all regex string per domain name, as follows: backend domain1 { .host = "10.10.10.5"; .port = "80"; } ...
1
vote
0answers
42 views

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: <If "%{HTTP_HOST} =~ /[a-z]+/i"> Define test_value "A" ...
1
vote
1answer
52 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 ...
3
votes
1answer
1k views

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 <LocationMatch ...
0
votes
1answer
152 views

Nginx Extract Top Directory Name From Request URI

I am in the need of being able to use top directory from the $request_uri, for example: /dir/sub/slug -> /dir I read the answer of this question: How to extract Only the file name from the request ...
1
vote
1answer
346 views

fail2ban-regex matches with strings, but not with log and conf files, why?

If I run fail2ban-regex '31.22.105.115 - - [11/Apr/2014:18:09:54 +0100] "GET /admin/config.php HTTP/1.0" 301 573 "-" "-"' '^<HOST> - - (?:\[[^]]*\] ...
0
votes
1answer
527 views

Filter python messages with regex in syslog-ng

I have syslog-ng (v3.4.7) configured to catch almost all messages in their respective logs, but recently I've included some python scripts in crontab and their output just goes to messages or debug ...
2
votes
1answer
2k views

Nginx redirect all old domain subdomains to new one

I had a very long domain, so I decided to change it to a shorter and more friendly one. But since I have a lot of subdomains (in fact, I have a subdomain wildcard), I wanted to keep the subdomain ...
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: ...
1
vote
1answer
791 views

fail2ban bad bots apache access log regex

Trying to block some bad bots using fail2ban reading Apache access log and stuck setting up correct regex. The line I want to match in the access log is: 5.10.83.65 - - [18/Mar/2014:09:06:38 +0400] ...
0
votes
0answers
57 views

Issue with a NGINX Location regex

I'm just dealing with a location issue today, I have a customer domain with the following format: subdomain.domain.tld and urls as: subdomain.domain.tld/servicename I'm trying to forward this ...
1
vote
1answer
119 views

Postfix regexp map for mailboxes

I need to forward all email that comes to mailbox by some mask to one specific mailbox. For example if recipient mail is 79001234567 it should be forwarded. line from /etc/postfix/main.cf ...
1
vote
1answer
385 views

Redirect all subdomains to main domain with lighttpd and regex

Is it possible to redirect all *.domain.com to my domain.com? I have been messing around with the Regex but without any luck: $HTTP["host"] =~ ".*\.domain\.com" { url.redirect = ...
0
votes
2answers
1k 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
0answers
46 views

Negative match for IP based RegEx

I am looking for negative matching for the below IP based regular expression: True-Client-Ip: ...
2
votes
0answers
38 views

List subfolders somewhere in the path with rsync

I'm developing a program, that will recursively "walk" through Linux repositories, look for PXE-related files and create gPXE configs. I met across a problem with the structure of Ubuntu catalogs on ...
0
votes
1answer
336 views

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 ...
0
votes
1answer
68 views

Invalidating email addresses from sql dump before import

Synopsis I would like to import production data into the development environment so testing can be done in an almost accurate way. Of course I need to invalidate e-mail addresses as I don't want ...
0
votes
1answer
195 views

Using named groups in a DirectoryMatch directive

I have the following directive in my httpd.conf: <DirectoryMatch ^/path/(?P<SI>[^/]+)/logs/bibi> php_admin_value open_basedir /path/?P=<SI>/ </DirectoryMatch> The ...
1
vote
0answers
154 views

Exchange 2013 Mail flow rule using RegEx

We're trying to implement a rule on certain mailboxes that it shouldn't accept an email without a subject. I found documentation from Microsoft on exchange 2010 to Configure a Transport Rule for ...
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 ...
1
vote
1answer
257 views

Whitelisting valid URL patterns on a NGINX webserver

I want to whitelist only valid URL-patterns on our RESTful webserver / API, using regexs or something. But when googling for some examples I get a little bit suspicious since there is not much ...