Click to See Complete Forum and Search --> : [RESOLVED] [Regex] Retrieve a string last value ........


whisher06
06-28-2007, 03:59 PM
Hi.
Sorry to disturb you but I'm not very
confident with regex therefore I'd like
to know your opinion on this regex:
(I've got a string like this
delete-post-number
number have got a range between 1
and 9999999999
)

var _aName= 'delete-post-1253';
var num=_aName.match(/\-([0-9]+){1,10}$/)[1];


It works but ................
What do you think about ?

Best wishes ;)

Kudose
06-29-2007, 12:31 AM
/-[0-9]{1,10}$/

There is no need to use the "+" since you want between 1,10 characters only.

There is no need for the parenthesis, they are just slowing things down.

whisher06
06-29-2007, 09:20 AM
:D