Filename chekcing

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

Moderator: General Moderators

Post Reply
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Filename chekcing

Post by spacebiscuit »

Hi guys,

I am trying to match file names which are a combination of numbers only, with a .php extension.

So far I have:

![0-9]+(.php)+!

But this is finding matches within a file names which might begin with a letter, such as: abc123.php

How can I disregard letters at the start of the filename?

Thanks in advance,

Rob.
fwycruiser118
Forum Newbie
Posts: 9
Joined: Sat Oct 09, 2010 7:45 pm
Location: Calif

Re: Filename chekcing

Post by fwycruiser118 »

/^[\d]+\.php/
Maybe what you are looking for is a circumflex anchor which enforces the name to begin with a number.
http://us2.php.net/manual/en/regexp.ref ... nchors.php
Post Reply