Hi Need help. New here

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
jms12
Forum Newbie
Posts: 1
Joined: Fri Nov 21, 2008 4:18 am

Hi Need help. New here

Post 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.
User avatar
GeertDD
Forum Contributor
Posts: 274
Joined: Sun Oct 22, 2006 1:47 am
Location: Belgium

Re: Hi Need help. New here

Post 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.
Post Reply