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
1 answer
How to match this URL with PERL REGEX in SQUID?
I am trying to match this URL but Its not working not matching at all ...…

Ghassan
- 1
- 2
0
votes
1 answer
Multiple protected locations with Nginx
I am trying to secure couple of locations using the basic HTTP authentication that comes with Nginx, but for some reason it won't work.
I have:
website.com/admin (This is accesible by user ADMIN)
website.com/admin/secret.php (This is accessible only…

Ivo Sabev
- 177
- 1
- 1
- 5
0
votes
1 answer
HAProxy reqirep setting results in 504 Gateway Timeout
I am trying to rewrite a single path via HAProxy. Without the rule in place, a 404 is returned for the directory page (from an IIS node). Once I add the rule, the page returns a 504 Gateway Timeout after a minute or so.
backend Example_Backend
…

Matt Beckman
- 1,502
- 18
- 33
0
votes
1 answer
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: Info: Login: user=, method=PLAIN,…

Minhaj
- 177
- 4
- 14
0
votes
6 answers
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 bksdjncknsdbcksbdcbhdhhb...
Not knowing the line# in the file, but…

Cor
- 15
- 1
- 5
0
votes
1 answer
Move all images in folder to subfolder, and update all references to those images to their new location?
I have a folder which contains a ~50 text files (PHP) and hundreds of images. I would like to move all the images to a subfolder, and update the PHP files so any reference to those images point to the new subfolder.
I know I can move all the images…

Professor Frink
- 529
- 4
- 7
- 15
0
votes
1 answer
What is this mod_security rule trying to prevent?
Today my IP was blocked by my server. I was told it was because of a mod_security rule that got triggered. I'm told that the regex that got triggered was
^((?:(?:POS|GE)T|OPTIONS|HEAD))
I don't know much about mod_security and was told
If the…

Mike Grace
- 197
- 1
- 6
0
votes
1 answer
(Apache) RedirectMatch regex to match all directories except those in my list
I need to 301 redirect all requests coming in for requests to http://server.com to be redirected to http://newserver.com unless the request is for an arbitrary list of directories we are maintaining on the legacy server (eg server.com/foo or…

dotben
- 1
- 1
0
votes
1 answer
(\d+) and ([0-9]+) htaccess rewrite not working on new server, works fine on old server
RewriteRule ^mp3/(\d+)/(.*)/$ download.php?id=$1 [L,NC]
is the specific rewrite rule I am trying to get working....it was working fine on my old server but now I am on a server with Apache 1.3.4.1 if that has anything to do with it.

Ian
- 1
- 1
0
votes
2 answers
Generic .htaccess www.redirect
There are plenty of examples here of how to redirect example.com to www.example.com, but I'm looking for a generic version, so the same htacess code would also work to redirect example.net to www.example.net and example.org to www.example.org. I'm…

TRiG
- 1,181
- 3
- 13
- 30
0
votes
2 answers
Recover programmation source files
I've source code files (Java and C++) to recover from a broken RAID 1+0 array, I've been able to access the virtual drive with an other server but the ReiserFS partition can't be recovered with ReiserFS tools.
I've made a binary image of the…

Alexandre Lavoie
- 154
- 12
0
votes
1 answer
Egrep Regular Expression to suppress certain lines
i try to use the following command to suppress certain lines of output that contain
the strings "DST=192.168.1" or "DST=192.168.2"
tail /var/log/messages | egrep -v -e 'DST=(192\.168\.1\.1)|DST=(192\.168\.2\.1)'
My Regex doesn't work, can someone…
user56548
0
votes
1 answer
Need a Mod rewrite regex solution for .htaccess
I moved my site to different server since then my all urls started showing up 404 error.
earlier my all urls were like this mysite.com/title-of-url
but now all such urls are getting 404 error, so i disabled seo friendly url feature on site admin and…
user55545
0
votes
1 answer
Need regular expression + Apache help urgently!
I want staging.mywebsite.com to point to the staging virtual host, for the live I want mywebsite.com and www.mywebsite.com to point to the live one etc., and then for *(everythingelse).mywebsite.com needs to point to the development server.
Anyone…

Walker
- 103
- 4
0
votes
1 answer
Strangeness using /usr/xpg4/bin/tr and /usr/bin/tr on Solaris 9
I have a file looking like this,
"xxxxxx"
"yyyyyy"
"aaaaaa"
"cccccc"
"bbbbbb"
"eeeeee"
"oooooo"
"zzzzzz"
Wanting to replace each \n in this file I use:
tr '\n' ',' < INPUT > OUTPUT
Which works fine. The output is to be…

Anders
- 283
- 1
- 4
- 12