In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "JS, replace how to use regular expressions to replace all the parameters of SQL for the specified format of data", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "JS, replace how to use regular expressions to replace all parameters of SQL to the specified format of data" it!
SQL parameter format for example: select * from tb where nd=:nd and yd=:yd
Want to replace all parameters (with colons) in SQL statements into data at once
Start
Choose to use regular expressions.
It was written like this before.
The copy code is as follows:
Strsql.replace (/ (:\ w +) / g, ("$1") .substring (1))
"$1" is always resolved to a string rather than a matching value
Replace it with
The copy code is as follows:
Strsql.replace (/ (:\ w +) / gjingo 1)
Can not give a matching value, $1 to get a matching value must be enclosed in double quotes.
Then a method was added to the whim.
Pass $1 as a parameter, as follows
The copy code is as follows:
Var strsql = strsql.replace (/ (:\ w +) / g, function ($1) {var b = $1; return $("#" + b.substring (1)) .val ();})
Thank you for your reading, the above is the "JS, replace how to use regular expressions to replace all parameters of SQL for the specified format of data" of the content, after the study of this article, I believe you on JS, replace how to use regular expressions to replace all parameters of SQL for the specified format of data have a deeper understanding of the problem, the specific use of the need for you to practice verification. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.