Skip to content
Advertisement

Regular expression [Any number]

I need to test for “[any number]” in a string in javascript. how would i match it?

Oh, “[” and “]” also need to be matched.

so string like “[1]” or “[12345]” is a match.

Non match: “[23432” or “1]”

So for example:

JavaScript

I need to replace input fields name: “items[0].firstname” to “items[1].firstname” thanks

Advertisement

Answer

UPDATE: for your updated question

JavaScript

Try this:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement