How can I exclude a specific string from a regular expression?

light9876

I have the following rule to match any website that begins with two numbers:

([0-9]+[0-9]+[a-z]+)+(\.net|\.com)

It matches domains like:

99abc.com 78c.net

How can I exclude from this rule a list of specific websites, for example

10ofthose.com 180post.net etc...?

Tim Biegeleisen

You could a negative lookahead blacklist to the start of the pattern:

^(?!(?:10ofthose\.com|180post\.net)$)[0-9]{2}[a-z]+\.(?:net|com)$

Demo

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Regular expression to exclude a specific string?

How can I be more specific with this regular expression?

Regular expression to exclude string from match

From within Java, how can I create a list of all possible numbers from a specific regular expression?

How can I use a Regular Expression to replace everything except specific words in a string with Javascript

How to exclude certain possibilities from a regular expression?

How to exclude a character from regular expression?

How to exclude a word from a regular expression in oracle?

how to get specific value from a string by using regular expression

How i can extract substring from string using regular expression in .NET

How can i get the url from the string by using regular expression or any javascript method

How can I get all matches of string in a regular expression?

How can I extract string using Php regular expression

How can I split string using regular expression in bigquery

How can I exclude a specific type from a TypeClass resolution?

Regular Expression to remove specific word from a string

A regular expression to exclude a word/string

How can extract string matches using regular expression from a List?

pandas series string extraction using regular expression : How to exclude certain symbols from the beginning?

How do I use a regular expression from a string variable

How can I extract number from text with regular expression

How to match a specific string with regular expression?

How to write a regular expression for specific string?

How can I exclude comma from the matched string?

How to I write regular expression that split by include token and exclude token

How to exclude a substring in a regular expression?

How can I construct a Template String from a regular string?

how to exclude some words from text with regular expression?

How to exclude some words from the search in a regular expression?