Page 1 of 1

Hi Need help. New here

Posted: Fri Nov 21, 2008 4:23 am
by jms12
Hi all,

I am new here and this is my first post. I need your help in building a regex for a pattern something like /abc-hi-123-page-3

I need to extract only the 123 as my output. This one is basically a website page pattern. I am trying to learn from extracting numbers using websites. Please help.

What would be the expression which would extract only the number "123"

Thanks,
Jms12.

Re: Hi Need help. New here

Posted: Fri Nov 21, 2008 5:50 am
by GeertDD

Code: Select all

(?<=-)\d+(?=-)
It is hard to tell what the general pattern is in the URL structures. The regex above hooks itself to the dashes around both sides of a number.