SoFunction
Updated on 2025-02-28

js intercept or replace the number implementation method in a string

When operating tables by js, we often need to get or modify the subscript in name, such as: name="cust[1]/custName";

replace:(/[\d]+/,num); //num is the numeric variable you need to replace with

Get:(/[\d]+/)。

Get multiple:(/[\d]+/g)。

The above method of implementing numbers in js intercepting or replacing strings is all the content I have shared with you. I hope you can give you a reference and I hope you can support me more.