I simply can't figure this out and have been trying for awhile. I need a regex that will parse data in the following manner:
Lets say I've got an input in the following format:
www.google.com
www.google.com/
www.google.com/something
I need a regex that will parse the above three URLs (individually) to final result of:
www.google.com
www.google.com
www.google.com
However, the way it needs to match them, is based on the following:
Parse and return everything to the left of a "/" if one exists in the line
Parse and return the entire line if no "/" exists in the line
I'm new to regex, so while this may be simple, I can't figure it out.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)