Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
How to get each youtube url from textarea in JavaScript?

Please solve my problem. I have a textarea. In this textarea i enter multiple youtube video url(line by line). My question is how to store each url as array using javascript. Thanks in advance.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

This code should works, I split the textarea value based on line break as you mentioned (line by line).

 let textarea = document.querySelector('textarea')
    let arr = []
    function check(){
      arr = textarea.value.split('\n')
      console.log(arr)
    }
<textarea>https://www.youtube.com/watch?v=EqboAI-Vk-U&t=22s
https://www.youtube.com/channel/UCK8sQmJBp8GCxrOtXWBpyEA</textarea>
 <button onclick = 'check()'>Check</button>

about 4 years ago · Juan Pablo Isaza Report

0

The simplest way would be to use regex like this (textareaValue contains the value of textarea):

const matches = textareaValue.match(/\bhttp(s)?:\/\/(www.)?youtu(be|.be).*\b/gm);

The matches will be an array of the urls that start with http(s)://(www.)youtube

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!