Currently I have an input box which will detect the URL and parse the data.
So right now, I am using:
var urlR = /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+) (?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/; var url= content.match(urlR);
The problem is, when I enter a URL like www.google.com
, its not working. when I entered http://www.google.com
, it is working.
I am not very fluent in regular expressions. Can anyone help me?
Related Posts:
- Javascript split regex question
- What is a good regular expression to match a URL? [duplicate]
- Is there a difference between /\s/g and /\s+/g?
- RegEx Ignore Case
- JavaScript replace/regex
- Regex for password must contain at least eight characters, at least one number and both lower and uppercase letters and special characters
- Escaping Discord subset of markdown
- How to test valid UUID/GUID?
- Regular expression : match either of two conditions?
- RegExp in TypeScript
- Converting any string into camel case
- I want to remove double quotes from a String
- Regular expression for removing whitespaces
- Javascript Regular Expression Remove Spaces
- How can I extract a number from a string in JavaScript?
- Remove not alphanumeric characters from string
- Extract hostname name from string
- Difference between ?:, ?! and ?=
- Remove all special characters with RegExp
- How do you use a variable in a regular expression?
- How to count string occurrence in string?
- Regular Expression to reformat a US phone number in Javascript
- Jquery Value match Regex
- RegEx: How can I match all numbers greater than 49?
- Regular expression to validate US phone numbers?
- javascript includes() case insensitive
- RegEx for Javascript to allow only alphanumeric
- Check user logged in with JS
- What is TypeScript and why would I use it in place of JavaScript? [closed]
- How to do associative array/hashing in JavaScript
- map function for objects (instead of arrays)
- How to play audio?
- How to write a countdown timer in JavaScript?
- TypeScript foreach return [duplicate]
- “document.getElementByClass is not a function”
- Parse Error: Adjacent JSX elements must be wrapped in an enclosing tag
- Nested JSON objects – do I have to use arrays for everything?
- How to find the sum of an array of numbers
- React Context vs React Redux, when should I use each one?
- jQuery AJAX submit form
- Difference between this and self in JavaScript
- HTML5 Local storage vs. Session storage
- Expressjs / Node.js – res.redirect() not loading page
- Using async/await with a forEach loop
- How to remove all listeners in an element?
- How do I check if an object has a key in JavaScript?
- How to add a “readonly” attribute to an ?
- JQuery $(“#content”).append not working
- What is the difference between null and undefined in JavaScript?
- Chrome/jQuery Uncaught RangeError: Maximum call stack size exceeded
- Counting words in string
- What’s “this” in JavaScript onclick?
- how to use react require syntax?
- document.getElementById(id).focus() is not working for firefox or chrome
- How to get height of div in px dimension
- How to get unique values in an array
- How to fix Error: listen EADDRINUSE while using NodeJS?
- How to allow CORS in react.js?
- Only on Firefox “Loading failed for the script with source”
- momentJS date string add 5 days
- When is a CDATA section necessary within a script tag?
- How to get scrollbar position with Javascript?
- where is create-react-app webpack config and files?
- “You may need an appropriate loader to handle this file type” with Webpack and Babel
- How to create checkbox inside dropdown?
- Find a value in an array of objects in Javascript [duplicate]
- How to wrap the content of the main tinyMCE editor with extra tags
- How to handle malformed response from WP REST API?
- Modals using loops and ACF [closed]
- Changes to JS not reflected on site
- How do developers add “Smooth Transitions” to their sites?
- Exclude JS file from 404 error page
- Pass data from wordpress to javascript in JSON
- How can I get my Calculate Contact Form 7 field to update with jQuery? [closed]
- Contact Form 7 – Uncaught TypeError: wpcf7.initForm is not a function [closed]
- js addclass function not working as expected, intereaction or special WP somethign needed?
- Where is script-loader.php creating JS tags
- WP TinyMCE (Full + media ) – 4.8 JS Init Dynamicly
- Get a default value of the Customizer setting using wp.customize API (JS)
- Search for a keyword across post types in a Gutenberg component
- Calling a WordPress Custom JavaScript file
- print script on wordpress header after user registered
- How do I use this javascript correct with wordpress?
- Load external javascript files
- Javascript alert appears before tag
- Bootstrap bundle present in page source but not working
- How to display different content on the same page using different URLS
- Web cover page open when button clicked
- Replace script attr or link
- Remove escape characters from JSON string pulled from a database
- How to pass data to javascript in custom widget class
- Client side pre-save Javascript hook on all admin pages
- WP Gutenberg – custom block with two content fields
- How to identify which javascript is being executed
- How to keep close a sub-menu under homepage? [closed]
- How to implement custom URL handler to access JS modal content? [closed]
- Contact form 7 hide and show fields depending up on the condition [closed]
- wp_enqueue has a resource but doesn’t generate a script tag [duplicate]
- Javascript not working on index.php but it is working on single post’s page
- Unable to change the location of a file