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)

1
vote
1answer
22 views

Filtering Berkeley Research Scanning Nginx logs with Logcheck

I'm getting Nginx log entries from http://researchscan1.eecs.berkeley.edu/ (and others), with lots of special characters in the requests, which I'm trying to filter out. E.g.: 2016/07/19 09:54:49 [...
0
votes
1answer
15 views

Certificate SAN support regexp stemming?

Searched on this, but can't find any clear answer - can a certificate SAN contain a name like "citrix*.domain.com", to permit use with citrixdirector.domain.com and citrixprod.domain.com, for example?
2
votes
1answer
3k 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
9 views

Varnishncsa for Varnish 4 split log by Vhost

In the varnish 3, varnishncsa can support -m option (-m tag:regex only list records where tag matches regex. Multiple -m options are AND-ed together. ). After upgraded to varnish 4, I cannot find the -...
1
vote
2answers
1k views

.htaccess 301 redirect with regex

I am trying to fix a lot of errors in our old website regarding a thing with product pages having multiple URLs associated with a single product. I am hoping that I can use regular expressions in ...
0
votes
0answers
29 views

Use RegEx to redirect all of website EXCEPT one URL

I've been directed here by support at WPengine, but I'm not sure whether this question should be asked here or over on Overflow... I'm using RegEx to redirect all paths and pages of a sub-domain to ...
0
votes
0answers
16 views

xinetd TFTP remap file & dnsmasq as PXE server

I'm playing with Openstack Ironic for the last few days. I am interested primarily in IPMI+PXE boot. So, in Ironic installation guide I have found the following xinetd tftp map file: re ^(/tftpboot/) ...
3
votes
1answer
63 views

Regex location block not working in NGINX

I have a pretty simple location block in my nginx conf that looks like this: location ~* ^\/[a-z0-9]{24}$ { // do some things } I'm attempting to catch urls that end in a Mongo ObjectId. eg: ...
0
votes
2answers
5k 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: [IP_1],[port_1],[ms_time_1];[...
0
votes
1answer
12 views

Apache location directive - PCRE negative combinations (match all but..)

Yes, I'm stuck still using apache2.2 on a system and I'm trying to use a PCRE with the apache Location directive looking for any URL not containing any images or similar. Here's some things I've ...
1
vote
3answers
56 views

Perl regex expression

I have the following string produced by a server log file. I am using Simple Event Correlator (which uses perl regex) to manipulate lines: 18:37:31 643.65.123.123 []sent /home/mydomain/public_html/...
1
vote
1answer
32 views

Fixing fail2ban regex rule for php-url-fopen filter

I'm fixing default php-url-fopen filter to allow some GET query parameters which I'm using in my system (it's not publicly available, but I would still like to block unnecessary requests). The problem ...
3
votes
1answer
2k 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 "http://my.domain....
0
votes
1answer
1k views

Nginx alias and regex

i'll need a bit of help for alias on folder with nginx I have my folder www/ with the container of my site example.com and a lot of folder like client0, client1, client2... I should NOT modify www/...
2
votes
1answer
1k views

How to block all incoming proxy visits except from one specific I.P?

I have a page that is prone to attacks, so, in order to reduce the anonymous attacks, I use this code in my .htaccess which I found online : # BLOCK PROXY VISITS <IfModule mod_rewrite.c> ...
1
vote
1answer
50 views

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] "\x00\x00\x00TZ\x00\x00\x00\x00\x00\x00\x00\...
0
votes
1answer
26 views

What's the error in my HTACCESS

index page and profile page show 404 after htaccess redirection I transfered from bogger to wp.. redirected all links from year/month/postname.html to postname/ using these lines: # WPhtc: Begin ...
0
votes
1answer
27 views

Logstash issue matching a substring of custom field

I have the following Logstash setup. Logs are piped to Logstash from Logspout via the logspout-logstash adapter, which adds a few fields to log messages, namely the docker.image field. I am able to ...
-1
votes
1answer
38 views

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 ...
0
votes
3answers
315 views

nginx: regex not matching URI

i have this URI /orls/myservice/f?p=4550 and the following location location ~ "^/(.+)/myservice/f?p=(.+)$" { ..... } nginx is returning a 404 not found. the problem might come from the ? so i ...
2
votes
2answers
83 views

Apache2 LocationMatch allow an index for login but nothing else?

I want to allow /myapp and /myapp/ but disallow everything else. How do I configure this? I tried this: <LocationMatch "^/myapp/.+$"> LDAP here </LocationMatch> Which I would assume ...
1
vote
1answer
45 views

Postfix Header_Check Regex 'Does Not Match' issue

I am trying to configure Postfix to NOT accept outbound messages with FROM addresses other than my own domains. The following regex successfully rejects only 3 domains: /etc/postfix/header_checks: /(...
0
votes
0answers
28 views

Fail2ban on CentOS, dovecot filters regex not matching logs

I'm starring at this regex for some time now and it seems perfectly matching lines from my log files but I can't get it to work, not even with modifications. I suspect the problem might be with the ...
0
votes
1answer
24 views

Using RewriteRule to match RewriteMap value and ignore any trailing slash and characters?

I'm trying to use RewriteMap in a apache 2.4 virtualhost .conf file to redirect a number of URLs. A variety of requests can refer to a single entry in the map and I'm having trouble matching these ...
8
votes
4answers
13k views

Using sed to remove both an opening and closing square bracket around a string

I'm running this command in a bash shell on Ubuntu 12.04.1 LTS. I'm attempting to remove both the [ and ] characters in one fell swoop, i.e. without having to pipe to sed a second time. I know square ...
2
votes
4answers
1k 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 ...
4
votes
5answers
13k views

Copy multiple folders to a single destination with robocopy

I'm looking for a solution to use robocopy to copy several folders from a directory onto a distant network share. I want to choose several folders out of a directory that contains hundreds of folders ...
0
votes
1answer
44 views

Simple nginx server_name regex does not find match

I have an nginx box running version 1.8.1 on AWS. I am converting numerous DNS routing conditions into nginx and have encountered many DNS entries where *.yet_another_domain.* would be useful, but ...
3
votes
6answers
9k views

Don't need the whole line, just the match from regular expression

I simply need to get the match from a regular expression: $ cat myfile.txt | SOMETHING_HERE "/(\w).+/" The output has to be only what was matched, inside the parenthesis. Don't think I can use ...
3
votes
4answers
5k 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" ...
3
votes
4answers
1k views

Extract repository name from GitHub url in bash

Given ANY GitHub repository url string like: git://github.com/some-user/my-repo.git or git@github.com:some-user/my-repo.git or https://github.com/some-user/my-repo.git What is the best way in ...
0
votes
6answers
196 views

Sed regexp /d deleting whole file

Given a typical known_hosts file: [123.45.67.89]:22 ssh-rsa bbuivvhbkbjdnflksndkfnksnfk... [98.76.54.32]:14444 ssh-rsa hohdibsodbfoasbfbsabdfbsd... [77.34.122.33]:32209 ssh-rsa ...
0
votes
0answers
7 views

Odd regex behaviour matching newlines with s and m modifiers

I wish to remove a block of code from a file - along with any unnecessary newlines. Input file 'test' <block 1> nothing here </block> <block 2> foo bar </block> <block 3&...
1
vote
0answers
21 views

nginx and site.erb: tag as internal users for two different domains and two different sets of IPs

I have an nginx server and a site.erb file and two different domains (domain1 and domain2). Currently a tag (for Google Tag Manager) will be set when someone visits the sites from a particular set of ...
0
votes
0answers
24 views

NGINX not recognizing $request

Well.. NGINX or me guess.. something that I'm not doing OK. The point is, I'm getting some request from bots of this type: 91.123.1.56 - - [04/Apr/2016:12:13:39 +0200] "V\x5CxA1po\x5CxA9^\x5Cx8F\...
0
votes
0answers
43 views

fail2ban regex correctly write

Sorry for my bad english. Server nginx. Block /administrator/ http_access_module nginx-error.log [error] 10934#0: *11435 access forbidden by rule, client: 213.87.x.x, server: localhost, request: "...
2
votes
1answer
271 views

fail2ban regex filter doesnt work with nginx log files

I have been banging my head all day trying to match my regex filter to my access.log with no luck. I have installed fail2ban on a gentoo server and its running fine (i manually baned my own IP and it ...
0
votes
1answer
35 views

Postfix header_checks and unicode regexp

Does postfix support unicode regular expressions like \p{Han} to detect unicode scripts? I would like to use them with header_checks.
1
vote
1answer
25 views

Rewrite bad url extention to .html in NGINX

A while back I made a mistake writing my urls and Google has them cached in old sitemaps. This is creating a ton of 404 errors in WMT that I need to clean up with a solid rewrite. I currently use the ...
1
vote
2answers
919 views

How to check if LocationMatch regex is working?

I have location match regex ScriptAlias /script /var/www/somescript.bash Action some-handler /script virtual <LocationMatch "/(?:\w+:)?\/\/[^\/]+([^?#]+)/"> SetHandler some-handler </...
0
votes
2answers
45 views

Serving images from two different directories with Nginx

This should be basic... I'm brand new, and no amount of googling and searching stack exchange is helping. I have a website that I want to be able to serve images from, from different directories. I ...
2
votes
1answer
98 views

mod_rewrite with multiple QUERY STRINGS

This is an extension to my question http://serverfault.com/a/761474/77231 I am trying to add an additional QUERY STRING parameter to the URL and change spaces to underscores but am having no success. ...
0
votes
1answer
5k views

Extracting matches in NGiNX with regex without if block

With NGiNX I get a string that contains information that I can extract content with regex. But the only way I found that I could do this, is with if block. Is there any another way? The extracted ...
0
votes
0answers
74 views

Regex nginx location with named location

I have the following set up - a production version of some software; location @myradio { rewrite ^/myradio/([^/]+)/([^/]+)/? /myradio/index.php?module=$1&action=$2 last; rewrite ^/...
0
votes
1answer
6k views

postfix header_checks using regexp proper setup

I just can't seem to figure out why header_checks are not being evaluated. I'm on Ubuntu 12.04, postfix 2.7, dovecote, spamassasin, clamav, amavis. I add following line to /etc/postfix/main.cf : ...
1
vote
1answer
26 views

Nginx rewrite to remove .php from files has no effect but to redirect to homepage

I'm trying to make a rewrite to remove .php from my URLs but so far no luck. Here's what I've got so far and then my results with this config below. location ~ \.php$ { try_files $uri/ @...
1
vote
1answer
315 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 ...
1
vote
1answer
50 views

Exchange 2013 RegEx transport rule

I am looking to create some transport rules for outgoing email based upon AD properties. eg. Phone: 123-456-7890 Where the actual inserted code looks like "Phone: %%PhoneNumber%%", retrieving the ...
3
votes
2answers
72 views

ubuntu 14.04 Apache 2.4.7 mpm_event Files and FilesMatch not working

We recently switched our Apache 2.4.7 mode from mpm_pre-fork to mpm_event. Since then we haven't been able to get our Files directive to work. <Files "*.php"> Header set Cache-Control "no-...
0
votes
1answer
713 views

postfix header_checks - regex spanning multiple lines

I would like to create a spam filter that spans multiple lines in headers. This is my /etc/postfix/header_checks file: /^From:.*name[0-9]+@.+[\r\n]+To:.*name@domain\.com/ REJECT It's a valid regex,...