Questions tagged [regular-expressions]
107 questions
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…
![](../../users/profiles/50878.webp)
Walker
- 103
- 4
0
votes
1 answer
I am trying to write an htaccess file performs authentication and redirects authenticated users to authorized directories. Can anyone help me with the condition syntax?
This is what I have so far but I can't get the RewriteCond and RewriteRule properly.
RewriteEngine On
RewriteCond %{LA-U:REMOTE_USER} (\d{3})$
RewriteRule !^%1 http://subdomain.mydomain.com/%1 [R,L].
AuthName "My Domain Protected Area"
AuthType…
![](../../users/profiles/41157.webp)
user41157
- 189
- 2
- 9
0
votes
0 answers
Testing Regular Expressions
I am trying to learn regular expressions, and came across some examples online. Trying to put things together, I inputted this into bash
^(([a-j][a-j]?)|(3[a-j][a-j])$
It returns the following error
bash: !!: event not found.
Why do you believe I…
![](../../users/profiles/960772.webp)
Smokefox
- 1
- 1
0
votes
4 answers
non greedy grep command on ubuntu?
I'm building a script which filters out all our translatables from our template system.
the problem i'm facing is the occasion where 2 translatables are on one line.
These are 2 example lines from a template file which both hold one or more…
![](../../users/profiles/29133.webp)
ChrisR
- 262
- 3
- 13
0
votes
1 answer
Postfix test: I can't forwarding outgoing emails
I am configuring a Postfix server in a test environment. It can only forward local emails. Outbound email must be redirected to /dev/null or to a local account. I found a solution on your forum but it unfortunately does not work properly.
I do not…
![](../../users/profiles/948367.webp)
jacobi
- 1
0
votes
1 answer
Postfix header_checks add X-Mailgun-Tag
I am trying to add in the postfix header_checks, using PREPEND, some X-Mailgun-Tag headers.
When using the following expressions in the header_checks, it applies without issues to all domain emails.
/^From:.*@example.com.*/i PREPEND X-Mailgun-Tag:…
![](../../users/profiles/626280.webp)
Nikos Klavdianos
- 11
- 1
0
votes
0 answers
Regular expression for location with slash at the end
I have location
location ~ /(apple|club|car|fly|fitness|nivea|nesquik) {
alias /srv/static-pages/$1.html;
}
I tried
location ~ /(apple|club|car|fly|fitness|nivea|nesquik)(\/)* {
alias /srv/static-pages/$1.html;
}
But it nothing gives…
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.…
![](../../users/profiles/616676.webp)
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…
![](../../users/profiles/620542.webp)
Viet Le
- 1
0
votes
1 answer
Find and Replace using Regular Expression
I try to find a way to find and replace using EMEditor and a Regular Expression. I try to applu this for the item below:
![](../../users/profiles/592412.webp)
Thom
- 31
- 1
- 3
0
votes
1 answer
Regular expression to find content that is sandwitched between 2 symbols
This might have been asked before but I cant find a solution. I am looking for a simple "Regular Expressions" search pattern to find something in my PHP files.
I am looking for the following pattern
![](../../users/profiles/592412.webp)
Thom
- 31
- 1
- 3
0
votes
2 answers
Find with regex not working on CentOS 7
I have problem with find and regular expression. I would like to find files in /etc, which name begin of a or b. I tried this commands:
find /etc -type f -regex '^a'
find /etc -regextype sed -regex "^a"
find /etc -regextype egrep -regex '^a'
find…
![](../../users/profiles/512504.webp)
PawelC
- 149
- 8
-1
votes
1 answer
validate file content with bash Regular Expressions + Linux
how to validate the following file content
that should be include single integer/float number
by bash Regular Expression or any other idea with awk/sed
cat /var/VERSION/Version_F35_project_usa
2.8
![](../../users/profiles/424911.webp)
jango
- 59
- 2
- 2
- 12
-1
votes
1 answer
sed + replace value default in grub.conf
I want to change the default value on all machines to default=0
default value could be any integer number
how to set in the sed syntax that default could be any number
my example ( not working )
for server_ip in $all_servers
do
ssh $server_ip…
![](../../users/profiles/346089.webp)
dandan
- 1,021
- 4
- 13
- 21
-1
votes
1 answer
how to make regular expression for nginx rewrite
i wrote
rewrite ^/([\w_]+)/?$ /index.php?$1
btw, i wanna except /empty.
hmm..
wanna use
/alphabet -> alphabet
/emptyABC -> emptyABC
/empty -> not match
/emp -> emp
/emptAB -> emptAB
How can I make regular expressions for these?
![](../../users/profiles/160153.webp)
user160153
- 17
- 1
- 3