RegEx: matching email addresses with subdomains for GApps - regex

I am trying to write a regex that works in Google Apps that matches email addresses on incoming messages with subdomains, e.g.:
root#*wildcard*.mydomain.com
but not
root#mydomain.com
So that I can use Gmail to redirect them to the proper recipient #mydomain.com.
The following regex works in my regex editor but doesn't match anything in Gmail testing:
^[-+.0-9A-Z_a-z]+#[-+.0-9A-Z_a-z]+\.(mydomain.com)$
For those of you familiar with GApps, I'm referring to the setting under Settings > Email > Receiving routing > Configure > Options.
Any help would be appreciated. Thank you!

Try putting the dash last; some regex dialects can't handle a leading dash in a character class. Other than that, your regex looks OK.
^[+.0-9A-Z_a-z-]+#[+.0-9A-Z_a-z-]+\.(mydomain\.com)$

Related

Regular expression for Google analytics for matching the domain name in a URL

I am too new to regular expressions and my effort at it so far seems futile. I'm trying to write a very simple regexp to match a domain name like google.com with any URL referrer like https://www.google.com.
So far I have tried /*google.com*/, (*google.com*) and [*google.com*] and none of these have worked.
Any help would be greatly appreciated.
Try the below regular expression. I assume you are applying this on the Hostname dimension.
.*google\.com.*
I wrote you a regex which matches prefixes, such as e.g.: https, http, ftp & sftp.
The regex can be found here:
http://rubular.com/r/7sLhefh2xE

Regex for sub-domain

I have several sub-domains configured to a IIS website. I would like to parse the incoming requests in ARR. I would like to match a specific sub-domain that would capture all these different scenarios
http://abc.example.com
https://abc.example.com
http://abc.example.com/xyz
https://abc.example.com/xyz
http://abc.example.com/xyz?q=123
https://abc.example.com/xyz?q=123
I have tried a few things but they don't seem to work and searches only reveal how to catch sub-domains and not just a sub-domain.
Thanks
Try this:
http(?:s)?:\/\/(abc)\..*

Regular Expression That Will Allow URL Redirect Of All URLs Without A String To Redirect To URL With That String

I have some versioned folders of site files that we are handling through IIS. What I need to do is create a URL Rewrite that will redirect traffic from all requests that don't match the most recent version, TO that most recent version. I'm having a difficult time as RegEx are not my specialty and I have been working on it for the last week.
Here's an example of what I need.
Most recent version:
https://testurl.com/v4/#
Older Versions:
https://testurl.com/#
https://testurl.com/v2/#
https://testurl.com/v3/#
These urls have other routes off of the base as well (ex. https://testurl/v3/#/rout1)
I'm needing a regular expression that will say "Any requested url that is does not contain the /v4/ to REDIRECT to the https://testurl/v4/#
Can someone point me in the right direction?
This regex will capture all domains of the form that you've listed. Capture group 1 will contain the actual route, eg / or /rout1.
/^https\:\/\/testurl\.com(?:\/v\d)?\/#(.*)$/
You can see it illustrated here: http://regexr.com/3fgo8

Glpi fail2ban regex

I'm using glpi and i want to monitoring the failed login attemtps with fail2ban. The log file is the following:
I need a regex rule for this log file, if the login attempts are failed and i want to ban the IP's with the fail2ban.
Can somebody help me?
Thanks!
use this: failed login for \w+ from IP (.*)
now your match group 1 holds the failed IP address. demo

Match URL Scheme with Port

I'm trying to match the the URI / URL scheme (e.x. ftp, http, https) using this regex ^(.*:) . The problem is that my url has a port number so the : to connote server connection in the scheme isn't the only one in the URL there is also :80. How do I just match the scheme using regex?
Given this example:
http://video.google.co.uk/videoplay?docid=-7246927612831078230&hl=en#00h02m30s
I would like regex to just match:
http
I'm not interested in something like
^((http[s]?|ftp):\/)
I know this would work it, it is limiting however. It wouldn't give me mailto, tel, ssh, etc.
I just found that ^[^:]+ works.