Say that we have an element with these classes: "floatLeft item4".
If I want to save the number "4" to a variable from "item4" how would i do that?
I think I would use this pattern "/item(\d+)/" but do I use replace or match and how?
using replace:
"floatLeft item4".replace(/.*item(\d+)/,"$1")
using match:
"floatLeft item4".match(/item(\d+)/)[1]
exec (alot like match)
/item(\d+)/.exec("floatLeft item4")[1]
using split (again, alot like match):
"floatLeft item4".split(/item(\d+)/)[1]
though the split method is not supported in all browsers (like IE..)