Python Regular Expressions (RegEx) Guide

A regular expression (RegEx) is a sequence of characters that forms a search pattern. RegEx can be used to check whether a string contains a specified search pattern. RegEx module There is a built-in package in Python called re that can be used to process regular expressions. Import the re module: import re RegEx in […]

boost.regex regular expression

Article directory wildcard regex_match function regex_search function regex_replace function Sample program Wildcard Some simple wildcards: +: Match one or more times; *: Match 0 or more times; . matches any character except newline characters \w matches letters or numbers or underscores or Chinese characters. Equivalent to [^A-Za-z0-9_]’. \s matches any whitespace character \d matches numbers […]

Apache shiro RegExPatternMatcher permission bypass vulnerability (CVE-2022-32532)

Vulnerability description On June 29, 2022, Apache officially disclosed the Apache Shiro (CVE-2022-32532) permission bypass vulnerability. When RegexRequestMatcher is used for permission configuration in Apache Shiro, and the regular expression carries “.”, an unauthorized remote attacker can construct malicious data packets Identity authentication is bypassed, causing the configured permission verification to fail. Related introduction Apache […]

Best regex alternative for Go

Introduction “Don’t use regular expressions or you’ll have 2 problems instead of 1” – or so the experts say. What’s left for those mischievous people who want to efficiently search through tons of templates? Of course, there are some cool solutions to this specific problem, such as Ragel or re2c. However, for my project, mastering […]

Halcon —tuple_regexp_match

tuple_regexp_match (Operator), I searched for a long time and couldn’t find the information I wanted, so I had to look it up myself. If I’m wrong, please feel free to comment. Your valuable opinions are welcome, thank you! Name tuple_regexp_match – Extract substrings using regular expressions. Signature tuple_regexp_match( : : Data, Expression : Matches) Description […]

Spark 3.4.x’s solution to the slow problem of from_json regexp_replace combination expressions

Background The solution to the slow problem of from_json regexp_replace combination expressions encountered in Spark 3.1.1 In fact, it has been solved in spark 3.4.x, The specific solution can be found in SPARK-44700, That is to set spark.sql.optimizer.collapseProjectAlwaysInline to false (the default is false) But how does spark 3.4.x solve it? Analysis Take the following […]

How to do a deep copy of date objects and regex objects?

I wrote an article earlier: Implement a deep copy function, if the object to be copied has a circular reference, how to deal with it? , which describes how to deep copy an object, the copy function is as follows: function deepClone(obj,map=new Map()) {<!– –> if (typeof obj !== ‘object’ || obj === null) return […]

The solution to the slow problem of from_json regexp_replace combination expressions encountered in Spark 3.1.1

Background At present, when the company upgrades from spark 2.4.x to 3.1.1, it encounters a kind of extremely slow SQL situation. The SQL is as follows (only the key ones are listed): select device_personas.* from (select device_id, ads_id, from_json(regexp_replace(device_personas, ‘(?<=(\{|,))”device_’, ‘”user_device_’), ${device_schema}) as device_personas from input ) Its ${device_schema} has hundreds of fields In the […]