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
0 answers
REQENV and SETIF If statement isn't evaluating correctly
....or it is and I've missed something.
So I have a website that can only be accessed via certain IPs. A new development is that I want some of the pages on the site to be open and freely available to everyone regardless of IP - lets say…

Richard Askew
- 101
- 2
0
votes
1 answer
Nginx split the URI into variables to use on proxy_pass
I'm tring to get the URI parts to then pass it to the proxy_pass url. But I don't know about regex to do this.
I need to get the first and last URI into a variables to pass it on the proxy_pass like this:
https://example.com/user/port
to
proxy_pass…

user1505698
- 11
- 2
0
votes
1 answer
RegEx passed by CSV file not working in PowerShell
Hi I have a script trying to pull out the price value from a html file. the Regex works when I assign it in the script but when I put the regex in CSV, it refuses to give me the result. Could someone help with this?
$htmlcontent = Get-Content…

Cliff
- 3
- 2
0
votes
0 answers
Fail2ban regex not banning IP address
I have the following jail added to jail.local file:
[nginx-honeypot]
enabled = true
filter = nginx-honeypot
port = http,https
logpath = /var/log/nginx/access.log
maxretry = 1
bantime = 86400
I created the filter nginx-honeypot.conf inside the…

adam78
- 119
- 1
- 3
0
votes
1 answer
Bacula fileset wildcards: how include /folder/(arbitrary string)/uploads but exclude /folder/(arbitrary string)/whatever/uploads
I'm creating an exclude rule for bacula so it doesn't take care of some cache and temporary uploads folders inside a filesystem. But I'm failing to write it
Suppose this…

Gonzalo Cao
- 111
- 1
- 5
0
votes
0 answers
fail2ban regex failing to work
I am trying to create a regex for my fail2ban filter to block all IPs that get a incorrect login on a web application. The way I distinguish this is that each login generates a GET request in the access log with this thing "?&err=1".
This is an…

ServerMan
- 15
- 4
0
votes
1 answer
nginx url rewrite regex with special characters
How to write a regex that matches a path node with reserved characters like '+','-' ? for example:
https://e.example.com/foo+/bar/file/test.txt need to be re-written as https://e.example.com/bar/file/test.txt
I tried rewrite ^/foo+(/.*)$ break; but…

Pahan
- 3
- 3
0
votes
1 answer
Need a regular expression to match 3-member simple series
I need a regex that would match the following example strings:
Example 1: "red, blue, and hot"
Example 2: "red, blue, or hot"
Three individual words, the first two followed by commas, and the conjunction 'and' (case 1) alternatively 'or' (case…

Tomáš Bažant
- 3
- 2
0
votes
1 answer
How to redirect all pages that contain a specific word using the .htaccess file
I have a bunch of indexed pages that start with the same word and they are all 404 so I want to redirect them all to the homepage of the site. The server is Apache, so I would like to use the .htaccess file.
So I need to redirect pages (for…

Petar Cvetic
- 3
- 2
0
votes
1 answer
Odd behavior of bash array
I've recently encountered a strange script behavior and still don't understand y the array behaves this way.
Here is a piece of the script:
for nCDATAReg in $(seq 1 4)
do
sTestBuffer1=$(grep -Pzoi '\/\/<\!\[CDATA\[[\s\S]*?\/\/\]\]>'…

Talcott Parsons
- 3
- 2
0
votes
0 answers
Dynamically move mails into matching mailboxes with sieve fileinto regex
I'm trying to create a sieve script, which files mails into mailboxes (or sub-directories of the inbox) matching a certain subject identifier.
For example if the subject includes 123 (three digits, 0-9), the server should check if a mailbox matching…

Breakfast Serial
- 1
- 1
0
votes
0 answers
How to modify fail2ban filter for openvpn to fit the DD-WRT logs in /tmp/var/log/messages?
I just installed Entware, on a DD-WRT router running openvpn server. I am trying to install a proper openvpn /opt/etc/fail2ban/filter.d/openvpn.conf filter for fail2ban, but am having problems modifying the regex filter posted at:…

DanRan
- 73
- 1
- 3
- 22
0
votes
1 answer
RegEx for 301 redirects to change path AND remove a string
I am looking for an RegEX redirect rule to redirect the image file locations to a new location, whilst also removing part of the original url which is the name of the image
OLD…

Rebecca Hubbard
- 3
- 1
0
votes
1 answer
Ansible Findall capture groups and list
I think I'm confused with Python and Ansible findall. Can I use capture groups in Ansible? For example, How can I capture group 1 and group 2 then reverse the position in the resulting list?
For example, I'm pulling some block devices info of a VM…

Billy K
- 121
- 1
- 3
- 16
0
votes
1 answer
Nginx reverse proxy base URI to change port
Hi i want reverse proxy my Nginx base port used
for example
http://example.com:443/ips/8443 -> http://example.com:8443/ips/8443
http://example.com:443/ips/23950 -> http://example.com:23950/ips/23950
If it supports this, it would be much better, but…

Mohsen
- 103
- 5