markwilfan Posted September 20, 2023 Posted September 20, 2023 any idea for making a regex for teachers of groups. format is [email protected]
altecsole Posted September 20, 2023 Posted September 20, 2023 Do you have a few lines of example text?
markwilfan Posted September 20, 2023 Author Posted September 20, 2023 (edited) i just want to match all emails [email protected] Edited September 20, 2023 by markwilfan
markwilfan Posted September 20, 2023 Author Posted September 20, 2023 (edited) this is what I've tried teachersof(\w+\.?)+.*(?!theplt.org.uk) Edited September 20, 2023 by markwilfan
altecsole Posted September 20, 2023 Posted September 20, 2023 (edited) Case insensitive: teachersof[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z0-9.-]+\.[A-Z]{3}+\.[A-Z]{2} Edited September 20, 2023 by altecsole
markwilfan Posted September 20, 2023 Author Posted September 20, 2023 Case insensitive: teachersof[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z0-9.-]+\.[A-Z]{3}+\.[A-Z]{2} Thanks altecsole, comes up with an error in gmail
altecsole Posted September 20, 2023 Posted September 20, 2023 Try enclosing the regex in quotes? "teachersof[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z0-9.-]+\.[A-Z]{3}+\.[A-Z]{2}"
markwilfan Posted September 20, 2023 Author Posted September 20, 2023 Try enclosing the regex in quotes? "teachersof[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z0-9.-]+\.[A-Z]{3}+\.[A-Z]{2}" nein. oh i hate regex!
altecsole Posted September 20, 2023 Posted September 20, 2023 Bard seems to think that it should work: The regular expression teachersof[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z0-9.-]+\.[A-Z]{3}+\.[A-Z]{2} is a valid RE2 regular expression. It matches the following string format: teachersof@.... For example, the following email addresses would match the regular expression: [email protected] [email protected] [email protected] However, the following email addresses would not match the regular expression: [email protected]e [email protected]@example.com [email protected] The regular expression starts with the string teachersof, followed by an email address. The email address must start with a username, followed by the @ symbol, followed by a domain name. The domain name must consist of a top-level domain (TLD) and a country code. The TLD can be any valid TLD, such as .com, .org, or .net. The country code can be any valid country code, such as .uk, .us, or .au. You can use this regular expression in advanced content match in Gmail to match emails from teachers. You can also use it in other Gmail settings, such as routing rules and filters.
altecsole Posted September 20, 2023 Posted September 20, 2023 Try this instead: teachersof\w{1,40}@[A-Z0-9]+\.theplt\.org\.uk
ThomL Posted September 20, 2023 Posted September 20, 2023 (edited) How about this: (\W|^)teachersof[\w.\-]{1,25}@[\w.\-]{1,25}\.theplt\.org\.uk(\W|$) Tried to modify the "Match Any Email Address from a Specific Domain" example here: https://support.google.com/a/answer/1371417 Found these guidelines too: https://support.google.com/a/answer/1346938 ***EDIT*** Not sure why I thought you were doing this in Google Admin... It seems my brain just decided this was the case and went with it... Edited September 20, 2023 by ThomL
markwilfan Posted September 20, 2023 Author Posted September 20, 2023 (edited) so an example would be [email protected] Edited September 20, 2023 by markwilfan
markwilfan Posted September 20, 2023 Author Posted September 20, 2023 so close but no cigar! teacherof doesn't get matched
ThomL Posted September 20, 2023 Posted September 20, 2023 so close but no cigar! teacherof doesn't get matched Which one, mine? Maybe this: [color=#333333](\W|^)[teachersof][\w.\-]{1,25}@[\w.\-]{1,25}\.theplt\.org\.uk(\W|$)[/color]
markwilfan Posted September 20, 2023 Author Posted September 20, 2023 hiya thom no yours doesn't work sorry 1
markwilfan Posted September 20, 2023 Author Posted September 20, 2023 (\W|^)[teachersof][\w.\-]{1,25} this is the bit that fails ahhhhhhhhhhhhhhhhhhhhhh
Davit2005 Posted September 20, 2023 Posted September 20, 2023 Anyone got some good tutorials or websites to convert to Regex mostly email addresses but also IP addresses. I've only used 1 or 2 times but trying to get my head around it
altecsole Posted September 20, 2023 Posted September 20, 2023 How about this: TeachersOf\w{1,20}\d{1,3}-\w{1,3}@\w{1,20}\.theplt\.org\.uk Assuming that the Student name is between 1 and 20 char, the number is between 1 and 3 char, and the letter after the - is between 1 and 3 char long. It also assumes that the bit before .theplt is made up of letters, and is between 1 and 20 char.
dmj Posted September 20, 2023 Posted September 20, 2023 Anyone got some good tutorials or websites to convert to Regex mostly email addresses but also IP addresses. I've only used 1 or 2 times but trying to get my head around it Depends on the regex type. Google pretty much use re2 This is a good place to start for re2 https://github.com/google/re2/wiki/Syntax And regex 101 is great for testing https://regex101.com/ 1
ThomL Posted September 21, 2023 Posted September 21, 2023 (edited) Does this work? (\W|^)teachersof|TeachersOf[\w.\-]{1,25}@[\w.\-]{1,25}\.theplt\.org\.uk(\W|$) I don't know enough regex... this matches on the tests I've done - I don't know how to make the teachersof|TeachersOf part case-insensitive. Edited September 21, 2023 by ThomL
markwilfan Posted September 21, 2023 Author Posted September 21, 2023 thanks guys TeachersOf\w{1,20}\d{1,3}-\w{1,3}@\w{1,20}\.theplt\.org\.uk seems to work so we'll go for that
markwilfan Posted September 21, 2023 Author Posted September 21, 2023 actually went for (\W|^)teachersof|TeachersOf[\w.\-]{1,25}@[\w.\-]{1,25}\.theplt\.org\.uk(\W|$)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now