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
3
votes
1 answer
Custom logcheck pattern matches using egrep, but logcheck doesn't exclude the relevant lines
We have a custom file for logcheck ignore patterns. Today I decided to add another one but it isn't working as smoothly as I'm used to.
What I normally do is craft a regular expression that will match the line(s) I need to ignore using egrep, and…

ThatGraemeGuy
- 15,473
- 12
- 53
- 79
3
votes
4 answers
Searching for a tail tool for Linux to colorize and suppress lines by regx?
Is there any tool that does both, colorize and filtering lines to suppress form output by regex?
user56543
3
votes
1 answer
Bash: How do I copy timestamps using touch and regex?
Since this is more of a Bash question I think this is better suited for serverfault than superuser, even though I'm talking about media files.
I had to make a batch conversion of several media files, and all the output files have a new…

user52487
- 33
- 1
- 3
3
votes
1 answer
SetEnvIf regex for setting Content-Disposition HTTP header
I am attempting to use the IHS 7.0/apache 2.2 SetEnvIf directive to set the filename of a downloaded file based on a url parameter. I think I am pretty close, however if there is a space (encoded or otherwise) in the filename - it fails.
example…

Erik Sorensen
- 103
- 1
- 5
3
votes
1 answer
How to validate the variable value with regex in ansible
how to validate the variable value using regex in ansible
var:
DeviceName: "xxxxx-ax34tas1.xxxint.pngxx.abc.com"
- name: valdiate switchname
set_fact:
switchname: "{{'false' if DeviceName |…

divay singhal
- 31
- 1
- 2
3
votes
3 answers
editing nginx http headers
we are trying to migrate from apache to nginx, and we have a setup where the proxy server receives an http header, modifies it and forwards it to the backend. This can easily be done with apache in the following way:
Header edit*…

MarceloPrego
- 46
- 1
- 3
3
votes
1 answer
How to Set Regular Expression for Nginx Location Block and Proxy Pass?
I would like to ask about some configurations for Nginx; How to setup regular expression in Nginx location block? this is my configuration
location ~ ^/web/api/v1/([A-Za-z]+) {
proxy_pass http://localhost:5000/$1;
}
So, the use case for this…

Tetsu
- 61
- 1
- 5
2
votes
1 answer
Caret within parenthesis in RewriteRule
What does this mean:
RewriteRule "(^|/)\." - [F]
I know the F flag means to throw a 403 forbidden error. And I know the escaped period means that directories starting with a period are forbidden. But what is the meaning of the caret, pipe and…

arnoldbird
- 125
- 5
2
votes
1 answer
Nginx proxy_pass long directive
i want to do proxy_pass
from https://foo.bar/api/v1/users/{userId}/store/{storeCode}/status to https://bar.foo/api/v1/users/{userId}/store/{storeCode}/status
and also
from https://foo.bar/api/v1/users/{userId}/opendate to…

jack deace
- 23
- 2
2
votes
0 answers
RewriteRules for .htaccess
This question has an accepted answer at
Stackoverflow
I have a PHP file named as otp.php.
When URL in the URL bar is
http://localhost/college/otp/MTA=/teacher
It should be treated as…

paran
- 31
- 3
2
votes
1 answer
HAProxy tcp-check expect rstring not working as expected
We have a status page that returns either "OK" or "Fail". We set up the tcp-check to look for "OK", which unfortunately doesn't work because it also matches "HTTP/1.1 200 OK" I was thinking I could use rstring with a pattern like .*^OK$. However,…

PlantationGator
- 139
- 1
- 6
2
votes
2 answers
Postfix error in regexp in body checks expression
Emails containing: blablabla.icu/blabla should be blocked. I get confused with this rule to block and emails that contain a link which address finish with .icu/:
/.*\.icu\/*./ Reject
The problem is that any emails, including attachments, that…

Kaf
- 169
- 9
2
votes
1 answer
Grep date with regex
I have files with lines in the following formats:
.
.
.
12/16/09 17:56:30.211 rest of line...
.
.
.
12/17/09 05:34:10.809 rest of line...
.
.
How do I grep the lines out of this file that are between two dates, i.e. all the values for one day? I…

Lance Roberts
- 401
- 3
- 12
- 29
2
votes
2 answers
Nginx location match multiple extensions unless path starts with specific word
How can I write a location block that matches any path ending in the following extensions:
jpg|jpeg|gif|css|png|js|ico|json|xml|txt|html
Unless the path starts with "/rails" (eg: /rails/randomstring/image.png)?
I currently have this basic…

Felipe Zavan
- 131
- 1
- 1
- 5
2
votes
0 answers
Regex RewriteRule in Apache 2.4 .htaccess
I want the URL: http://api.relaunch.local/rest/v1/akb/
To rewrite to: http://api.relaunch.local/?id=1873&eID=dispatch&controller=akb
Where akb is the variable part.
I tried endless variation without success, here is my last try in…

bandanh
- 123
- 3