In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
How do I use regular expressions to remove brackets? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Example: color: pink [10] size: s [5]
Remove [] and content:
Preg_replace ("/\ [. *\] /",', $str) 1
Effect after treatment: color: pink size: s
Tip: you can change [] to other symbols and apply them where needed.
Ps: let's take a look at extracting the contents in parentheses using regular expressions
For example, now we want to extract the word "China" in parentheses in the sentence "people's Republic of China" for short (China).
Import java.util.regex.Matcher;import java.util.regex.Pattern;public class Test {public static void main (String [] args) {String str = "people's Republic of China, abbreviated as (China)." ; Matcher mat = Pattern.compile ("?
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.