Can regular expression be written in /private/etc/hosts file

15,126

Solution 1

No, this is not possible.

See these related questions:

Solution 2

This is not possible in the hosts file. For acceptable syntax see this: /etc/hosts file

Share:
15,126

Related videos on Youtube

Chealion
Author by

Chealion

Chealion - http://chealion.ca IT Manager at a television production company in Calgary, Alberta

Updated on September 17, 2022

Comments

  • Chealion
    Chealion almost 2 years
    abc.local
    xyz.local
    dumy.local
    www.google.com
    local.testserver.net
    

    ....

    Can we write some kind of regular expression or Rule in "hosts" file to redirect certain domains ending .local to certain ip address. like using above domains.

    192.168.0.10 *.local
    192.168.0.1 www.*
    192.168.0.100 local.*.*
    

    // Hosts file path on Mac OS X is /private/etc/hosts and in windows c:/windows/system32/drivers/etc...

    • Arjan
      Arjan almost 14 years
      Mac, not MAC, please.