Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6164217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:57:22+00:00 2026-05-23T21:57:22+00:00

For this example lets say I want to validate a google plus profile URL

  • 0

For this example lets say I want to validate a google plus profile URL in JavaScript.

A typical google plus profile URL looks like:

https://plus.google.com/115025207826515678661

I basically want to make sure at least the beginning of what was typed in the text input form was:

http OR https ://plus.google.com/

How could this be done in JavaScript? Every example I find is just a simple validate if its a URL or not. Not if it contains part of a specific URL.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T21:57:25+00:00Added an answer on May 23, 2026 at 9:57 pm

    You could use a regex such as /^https?:\/\/plus\.google\.com/, but, I’d rather use the DOM.

    This should do it…

    var str = 'https://plus.google.com/115025207826515678661',
        a = document.createElement('a');
    
    a.href = str;
    
    var valid = ((a.protocol == 'http:' || a.protocol == 'https:')
                  && a.hostname == 'plus.google.com'
                );
    

    jsFiddle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say this page www.example.com/mypage returns some html that I want to parse in
For Actionscript 2.0 Let's say this page www.example.com/mypage returns some html that I want
This is a contrived example, but lets say I have declared objects: CustomObj fooObj;
Let's say I have this url: www.example.com/test.php?page=4 How do i retrieve the value of
Using a very simple set of objects for this example in PHP. Lets say:
I have a page on my site, for purposes of this example lets say
In javascript, lets say I want to access a property deep in an object,
For example, let's say this is my abstract class: abstract class A{ int x;
This is a very generic 'best practice' question, but here's an example. Let's say
DataGridView, for example, lets you do this: DataGridView dgv = ...; DataGridViewCell cell =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.