Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use regular expressions to extract the src content of the & lt;img> tag in the input box

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you how to use regular expressions to extract the contents of the input box.

The src content of the tag is easy to understand and well organized. I hope it can help you solve your doubts. Let the editor lead you to study and learn how to use regular expressions to extract the contents of the input box.

The article "src content of tags".

The small script implements the extraction of the contents of the input box

The contents of the src in the tag, then replace the content in the original location, and then remove the html tags, spaces and other operations in the input

_ window.onload = function () {var target = document.getElementById ("div1"); var but = document.getElementById ("but"); var value; but.onclick = function () {value = target [XSS _ clean]; result = dealText (value); alert (result);}; function dealText (msg) {var text1 = imageRound (msg); var text2 = removeTag (text1) Var text3 = removeBlank (text2); var text4 = changeNBSP (text3); return text4;} function DealNum (num) {var content = []; for (var I = 0; I

< num.length; i++) { // content.push(defaultSrc(num[i])); } return content; } function defaultSrc(src) { return ':avator:'; } function returnValue(srcValue) { var num = []; var pattern = /([^\/]+)\./; var src; for (var i = 0; i < srcValue.length; i++) { src = pattern.exec(srcValue[i])[1]; num.push(src); }// alert(num); var source = DealNum(num); return source; } function imageRound(text) { var reg2 = //gi; var s = text.match(reg2); var num = returnValue(s); var i = 0; var content = text.replace(reg2, function () { return num[i++]; }); return content; } function removeTag(text) { var text1; var reg = /|/g; text1 = text.replace(reg, ""); return text1; } function removeBlank(text) { var text1; var reg = /\s+/g; text1 = text.replace(reg, ""); return text1; } function changeNBSP(text) { var text1; var reg = / /g; var reg1 = /\;/g; text1 = text.replace(reg, ' '); text1 = text1.replace(reg1, ""); return text1; } abc efg 

Hi gk

Lmnop q rst uvw updates the above is "how to use regular expressions to extract the contents of the input box

Tag src content "all the content of this article, thank you for reading! I believe you all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report