Question: This is my list of domain need to filter with regex :

```
/([a-zA-Z0-9.][^])/g

```

It matches all character without exceptions. I want to filter characters without .com, .net or any TLDs, so the regex works like this:

```
zjpsmsmnijda -->match
zjpsmsmnijd01828282 -->match
zjpsmsmnijd.com -->not match
zjpsmsmnijd.net -->not match
hadjhajdhjdjad.com -->not match
jjsjsjjsjjs.com -->not match
qhwnnajskkalls.org -->not match
qhwnnajskkalls.net.in -->not match
qhwnnajskkalls.co.in -->not match
qhwnnajskkalls.ly -->not match
SHEYEKSISKKISIM -->match
SAHSJJASHASH1212937888 -->match
ABCHHSHHAJJSJJS.COM -->not match
HSHHJASJHSJHJSH.NET -->not match
hasjjashajshajshas.com --> not match
hsahsjahsjashjashja -->match
hshhhhsahsjahsjahsjashajshasjhssajh -->match

```

Answer: 
There is a *very* large [list of TLDs](https://data.iana.org/TLD/tlds-alpha-by-domain.txt) nowadays (currently 1240), and it grows too quickly to keep up. There's no way you want a regex to match these.

(If you really want to match the true list of TLDs, scrape that link into a hash, extract potential TLDs from your test data, and look them up in the hash. Do not use a regex with over a thousand alternations!)

Instead, I'd just match anything that *looks* valid:

```perl
/\.(?:[a-z]{2,}|XN--\w+)$/i

```

(This matches valid TLDs. Invert its result to get invalid TLDs.)

This keys on two patterns. I'll do the second alternation first. [Punycode](https://en.wikipedia.org/wiki/Punycode) is used for internationalized TLDs and is always formatted with a leading `XN--` and is then followed by alphanumerics. Otherwise, no TLD contains numbers and every TLD contains at least two letters.
If I understood your intention correctly, you want to get domain names without TLDs etc. [Using this utility](http://regexr.com/), you can construct regex interactively. So, to get a list of simple strings:

```
/^[a-zA-Z0-9]+$/gm

```