Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- console.log("Вывод результата использоввания регулярки на URL" + "\n");
- let url = " http://agemagic.ru.ru/age/dgdgd.ru даьыда http://example.example/example/example.example";
- let arrayUrl = [];
- let regexUrl = new RegExp('(http(s)?:\\/\\/)(\\b\\w*\\b)((\\.\\b\\w*\\b)+)((\\/\\b\\w*\\b)*)(\\.\\b\\w*\\b)?(\\/)?', 'g');
- https://pastebin.com/K8FhxRve
- arrayUrl = Array.from(url.matchAll(regexUrl));
- for (let i = 0; i < arrayUrl.length; i++){
- console.log(arrayUrl[i][0] + "\n")
- }
- console.log("\n\n" + "Вывод результата использоввания регулярки на Email" + "\n");
- let email = " \n" +
- "tes-t@mail.ru.t.gdgdg.d.fgd.fgd\n" +
- "\n" +
- "RegExr was created by gskinner.com, and is proudly hosted by Media Temple. \n" +
- "to you\n" +
- "Edit the Expression & ./csdfds .Ttes-t@mail.ru.t.gdgdg.d.fgd.fgdext to see matches. Roll over matches or the expression for details. PCRE & Javascript flavors of RegEx are supported.\n" +
- "http://example.example/example/example.example адпьвдврb,mh.gdh\n" +
- "The side bar includes a Cheatsheet, full Reference, and Help. You can also Save & Share with the Community, and view patterns you create or favorite in My Patterns.\n" +
- "\n" +
- "Explore results with the Tools below. Replace & List output custom results. Details lists capture groups. Explain describes your expression in plain English.\n" +
- "\n" +
- "hello.";
- let arrayEmail = [];
- let regexEmail = new RegExp('(\\w|-|_)*@(\\w|-|_)*(\\.\\b\\w*)*', 'g');
- arrayEmail = Array.from(email.matchAll(regexEmail));
- for (let i = 0; i < arrayEmail.length; i++){
- console.log(arrayEmail[i][0] + "\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement