0

Thank you again for trying but once again it does not pick up an IP, host, aliases when they are incorrectly placed in the same line as another.

0

Hmmm, I guess that could be a tricky one to solve because it could be dynamic in what's considered "incorrectly". That might have to be looked at as an issue. Like a programming syntax error you might say.

I say that because where would you know to split and start a new? Especially because x amount of aliases can follow the host name. So if they are on the same line, they could all be considered aliases.

Aliases and Hostnames can be alpha-numeric as well as a dash and period, while IPs can only be numerical and a period. The reason I point this out is because since all the allowed characters of an IP are allowed in an Alias or Hostname, you wouldn't know when you got to a new IP.

It's probably why the standard is one per line, because when the file is parsed (or interpreted) by the system, they would run into this same issue, with only the return line being the delimiter as to a new IP.

0

Thanks for the input and points.
I've done what I need so far and I get all the entries, it just takes me several passes.

I am really appreciative that this thread caught your fancy, and I've learned a lot from your posts and code.

Thank you so much.

0

Glad I could help. I do love writing Regex, so any excuse to write it automatically can gain my interest.

Out of curiousity, what rule did you set to account for the multiple entries on a single line?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.