SoFunction
Updated on 2025-03-02

Use regularity to quickly find different characters in two strings

x(?=y) is called a forward assertion (Positive look-ahead). x only matches before y. y will not be included in the return result. For example, to match the number followed by a percentage sign, you can write it as /\d+(?=%)/. This article mainly introduces relevant information about the forward assertion of regular expressions (?=). Friends who need it can refer to it.
2022-11-11