Questions tagged [regex]

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.

720 questions
0
votes
0 answers

Ansible: extracting a string between two strings

So I have an html file that contains the following somewhere in the middle: http:(...).com I'm attempting to extract the url, but am having some issues doing so. Because that "ltr" is the only one that exists in the html, I…
Ress
  • 45
  • 1
  • 2
  • 8
0
votes
1 answer

How do you use regex flags in postfix?

In Postfix we can apply some basic header, body, client checks using regex. I wanted to use flags. I added the following to the header_checks file: /some(\s|_|-)words(\s|_|-)here/gmi REJECT and tested it by sending myself and email with those words…
Altimus Prime
  • 364
  • 2
  • 7
  • 22
0
votes
1 answer

nginx: Location block for all URIs without extension

I know how to process URIs that match a certain pattern. Example The following configuration will add an Cache-Control http-header to all files ending with .css or .js: location ~* \.(css|js)$ { add_header Cache-Control "public, max-age=31536000,…
Sr. Schneider
  • 185
  • 2
  • 6
0
votes
1 answer

Nginx not captures regex variables

Trying to capture URLs like http://mydomain/1234567890123 (13 digits) location ~ ^/([\d]{13})$ { proxy_pass http://127.0.0.1:4000/product?id=$1; } $1 variable arriving empty, even if URL is being captured. What am I…
Tamir
  • 101
  • 2
0
votes
1 answer

Ansible regex didn't match command output - Empty list -

I'am trying to get the list of the device ID and the list of the port Id with ansible with regex but i get an empty list, below the output that i'am trying to parse it : Device ID Local Intrfce Holdtme Capability Platform Port…
0
votes
2 answers

Need assistance to rewrite url in Nginx for WHMPRESS

I need to rewrite URLs in NGINX. I tried many examples from google searches but failed. /manager/?whmpca=order_process&a=add&pid=5&a=add¤cy=1&billingcycle=monthly I need to rewrite it…
Faheem
  • 11
  • 2
0
votes
0 answers

Regex on htaccess file gives INTERNAL REDIRECT error

I'm trying to create a redirect rule that matches the following…
Lucas
  • 101
  • 1
0
votes
1 answer

How to rewrite urls using ProxyHTMLURLMap?

My urls are in this form /sites/site-name/Subpath-2/page-name.page /sites/site-name/Subpath-3/Subpath-4/index.page And this should be rewritten as /sitename/subpath/pagename (the extention .page is removed) also the subpath can have multiple…
0
votes
1 answer

haproxy 2.2.x - acl url_reg wont work anymore

I try to udate from haproxy 1.8.25 to 2.2.9. Everything is fine so far, but all may acl for url filtering to route some traffic to diffrent backends wont work anymore. Example: this request https://www.foo.bar/images/charts/test.png shoud be go to…
foo bar
  • 11
  • 3
0
votes
2 answers

Get the first letter of subdomain as variable

How do I get the first letter of a variable in nginx example server_name ~^(?\w+)\.development\.test$; location / { root /var/www/test/$subdomain.0/$subdomain; try_files $uri $uri/ =404; …
MC-ifac
  • 3
  • 1
0
votes
1 answer

Save rsyslog messages to dynafile that extracts text from rawmsg

We have a few appliances that are sending syslog, unfortunately their hostname are not the same as the actual name configured on the service I'm running the latest rsyslog version. Currently I have this saved as a seperate conf file: template…
sarvesh.lad
  • 137
  • 6
0
votes
1 answer

Fail2ban banning odd IP address that are not in logs (0.0.0.4, 0.0.0.5, etc)

Server: Nginx Fail2ban version: v0.9.3 It seems like no matter what I try, I cannot get fail2ban to find the correct host from the log entry consistently. /etc/fail2ban/filter/expanse-bot.conf: [Definition] failregex = ^(\d{2}|\d{3}) \| \|…
DevOpsSauce
  • 348
  • 1
  • 5
  • 22
0
votes
1 answer

Regular Expression in EMEditor

I am trying to make a simple find > replace regular expression. This does work fine in https://regexr.com/ to find this comment below. However the editor I use is EMEditor that i try to make a find and replace trough files and subdirectories.…
TAPIO
  • 1
0
votes
1 answer

Nginx isn't passing on the last forward slash of an arg to a script

Have an issue where nginx isn't passing on the last forward slash of an arg to a script Example https://xxxx.com/test_t/company/Default/icon_category/Hotel.png Rewrite: location / {​​ rewrite…
0
votes
1 answer

Postfix header_check regex with if conditional not matching - change sender address when recipient domain matches

I have a header_check that should match when the RECIPIENT address is domain.com and if it matches, then it changes the SENDER address to systems@service.domain.com Scratching my head a little on this. Here is my header_check: if…
HarryT
  • 13
  • 4