In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.