Skip to content

Conversation

@igorplaton
Copy link

not_found_string as array for multiple options,
added new prefix "negation" for check isAvailable,
added new rule for SK domain into whois servers JSON

@johnny-bit
Copy link

Hi!

At first I believed Your change to be correct and quite nice, however after re-scanning it and changes needed to both whois.servers.json and general logic of processing whois, I came to conclussion that this might not be the best way to handle this 😉

In my opinion you could use grouping operators and negative lookaheads. That way instead of complicating code for parsing, you could write single regex for all cases (that kind of thing is mandatory in most stuff I have to deal with).

For example, let's say registry returns 3 different is-available responses for 3 different reasons of domain availability:

"Domain not found in DB"
"Domain released for registration"
"Domain expired, returned for availability"

So, instead of putting those 3 lines in json and generally complicate parsing of that json, why not write them as single regex:

"Domain (not found in DB|released for registration|expired, returned for availability)"

Single line, covers all 3 cases.

Now - what about negative match? Say this says domain is not available, and registry returns random gibberish for available domains:

"Domain is registered"

That put in negative regex would be (I might be mistaken here ;) ):

"((?!is registered).)*"

I'm working on active and more-maintained fork, so I want to incorporate as many good changes as possible 😄

$return = true;

if (is_array($not_found_strings)) {
foreach ($not_found_strings as $not_found_string) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to respect the original codestyle when you're making a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants