0

How do I serialize the following url with lua?
Is it possible with the "match"?

http://example.com/go.php?user=stack&pass=overflow

Domain: example.com
User: stack
Pass: overflow

1
  • 1
    you mean how to deserialize or parse that url Commented Feb 8, 2021 at 7:34

1 Answer 1

1

Try this:

s="http://example.com/go.php?user=stack&pass=overflow"
d,u,p=s:match("http://(.+)/.*user=(.-)&pass=(.+)")
print(d,u,p)
Sign up to request clarification or add additional context in comments.

2 Comments

http://example.com/go.php?pass=overflow&user=stack That should work as well, but wouldn't in this case.
@DarkWiiPlayer, indeed.But the OP hasn't indicate whether to expect this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.