After I did this, the interviewer stopped me and told me in a negative way that he expected me to use a regex, which kinda shows he had no idea how a web browser works.
After I did this, the interviewer stopped me and told me in a negative way that he expected me to use a regex, which kinda shows he had no idea how a web browser works.
Unless it was a specific url with specific params?
Like, for just the params part (yes, broken and simplistic):
#!/usr/bin/perl
$_="a=b&c=d&e=f&whatever=some thing";
while (s/^([^&]*)=([^&]*)(&|$)//) {
print "[$1] [$2]\n";
}My imagined remedies are no 1:1 interviews and recording these sessions for "possible quality assurance and training purposes".
TLDR: it’s a traditional parser—a big state machine that steps through the URL character by character and tokenizes it into the relevant pieces.
And if they still insist even after the source of Chromium and FF has been consulted. Well then it’s time to leave. Don’t want to work with anyone like that.