Questions tagged [regular-expressions]
107 questions
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
5 answers
Regular Expression matching in ssh config
I have a bunch of servers with the names srv1.domain.com, srv2.domain.com, ..., srv50.domain.com
I want to be able to connect to these servers by ssh srv1
I don't want to put 50 configuration entries to my .ssh/config such as
HOST srv1
HOSTNAME…
![](../../users/profiles/33333.webp)
Ruggiero Spearman
- 143
- 1
- 1
- 5
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…
![](../../users/profiles/9227.webp)
djangofan
- 4,172
- 10
- 45
- 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…
![](../../users/profiles/77497.webp)
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,…
![](../../users/profiles/81737.webp)
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…
![](../../users/profiles/68036.webp)
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…
![](../../users/profiles/549613.webp)
Simone Marchioni
- 11
- 1
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…
![](../../users/profiles/522838.webp)
Giorgi Lagidze
- 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…
![](../../users/profiles/476602.webp)
Chebarbudo
- 73
- 1
- 6
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…
![](../../users/profiles/438830.webp)
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…
![](../../users/profiles/363273.webp)
nav
- 33
- 1
- 7
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,…
![](../../users/profiles/11495.webp)
DrStalker
- 6,676
- 24
- 76
- 106
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…
![](../../users/profiles/227595.webp)
Jaap de Wit
- 88
- 6
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…
![](../../users/profiles/260580.webp)
ltwally
- 315
- 2
- 6
- 21
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…
![](../../users/profiles/256133.webp)
Toms Bugna
- 123
- 1
- 7