Questions tagged [regular-expressions]
108 questions
2
votes
1 answer
nginx httpMapModule regex variables
The HttpMapModule documentation states that:
Since 1.0.4, case insensitive regular expressions can be used by prefixing the pattern with ~*.
And gives the example:
map $uri $myvalue {
/aa /mapped_aa;
~^/aa/(?.*)$ …

Robin Winslow
- 209
- 1
- 3
- 11
2
votes
2 answers
Display nth instance of grepped pattern
So here's my problem. I have an issue with a .csv file (Current.csv) in that there are commas randomly place throughout the data, so awk-ing the file doesn't give me constant column numbers for a particular type of information I'm looking for. …
user121351
2
votes
2 answers
Get Apache2.2 to hide Microsoft documents that are being edited?
I have a htdocs directory where I am serving a few Microsoft Word documents. When someone is editing a document, the name of the document changes to look like something like this: "~$my_document.doc" and also .tmp files are created that represent…

djangofan
- 4,182
- 10
- 46
- 59
2
votes
1 answer
Postfix setting reply-to field to sender
I would like to set the reply-to field to the sender of the mail if the recipient matches some addresses. I know I could do a regular expression like this to do this
/^(To|Cc):.*foo@bar.com/ PREPEND Reply-To: bla@example.com
But that would be…

plaetzchen
- 173
- 1
- 3
- 9
2
votes
2 answers
Watchguard Firewall WebBlocker Regular Expression for Multiple Domains?
I'm pretty sure this is really a regex question, so you can skip to REGEX QUESTION if you want to skip the background.
Our primary firewall is a Watchguard X750e running Fireware XTM v11.2. We're using webblocker to block most of the categories,…

bopapa_1979
- 439
- 1
- 5
- 12
2
votes
1 answer
Regular expressions and .htaccess - need help with understanding
I understand .htaccess and mod_rewrite on a fairly basic level, and have just started learning ForceType and SetHandler directives.
This is my .htaccess file for my domain, testsite1.localhost (only accessible via 127.0.0.1 as indicated in the…

whitstone86
- 25
- 4
1
vote
0 answers
Postfix header_checks not working: Invalid preceding regular expression
I have a problem with Postfix.
Recently we are receiving mail messages with malformed "From:" headers as these:
From: "Name Surname "
From: "user@good-domain.com"
Ended up with a…

Simone Marchioni
- 11
- 2
1
vote
2 answers
regular expression that has /admin in the middle and whole string ends with specific format
I am trying to write a regular expression such as it has /admin in the middle and ends with .css or .js or other formats.
http://example.com/admin/static/style.css (SHOULD WORK)
http://example.com/admin/static/vendor.js (SHOULD…

Chemistry
- 111
- 1
1
vote
1 answer
postfix smtp_generic_maps with regular expression
I just started playing around with sender address rewriting with postfix.
I run a server with debian-7.11 and postfix-2.9.6.
Content of /etc/postfix/main.cf:
[...]
smtp_generic_maps = hash:/etc/postfix/generic
[...]
Content of…

Chebarbudo
- 83
- 1
- 8
1
vote
1 answer
Modify puppet nodes.pp with regex based on network (facter) subnet coverage - needs peer review
For the puppet experts out there, I am trying to modify my node.pp based on the facter network.
Example, I would like to have subnets 10.10.10.0 through 10.10.10.255 and 192.168.2.0 network to get the following puppet modules.
In my nodes.pp does…

Ryan
- 11
- 1
1
vote
2 answers
Regex works everywhere ( tried regex101 and regstorm.net) except Powershell
I have tried various different combos and already checked other similar posts, but can't find my answer. I have a .config file and I need to exclude the comments from the file when I do my search, something like below:
(Get-Content…

user3421341
- 33
- 1
- 1
- 8
1
vote
2 answers
Using a regular expression (perl?) on a MySQL DB
I have a MYSQL DB and I need to do some text manipulation on one of the fields. This is a one-off, not an ongoing process.
The built in MySQL text manipulation functions will be a nightmare to do what I need to do.
Perl can do it in a few lines,…

DrStalker
- 6,946
- 24
- 79
- 107
1
vote
1 answer
Nginx rewrite rule remove subfolders
I'm trying to setup a nginx rewrite rule but can't figure out how to get it working.
I want to redirect all urls https://domainname.com/archives/year/month/date/postname to https://domainname.com/postname
The page https://domainname.com/archives…

Jaap de Wit
- 88
- 1
- 7
1
vote
1 answer
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 phone number from AD. That part works fine.
Setting…

ltwally
- 315
- 2
- 7
- 23
1
vote
1 answer
Nginx Config Location Regex With Language Code In Url
Trying to achieve constant language code in url's 1st segment with nginx regex location configuration and could not find the correct syntax.
Necessary result:
example.com stays example.com
example.com/en stays example.com/en
example.com/en/ stays…

Toms Bugna
- 123
- 1
- 7