Re: regex problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/06/06, Merlin <ngroups@xxxxxxxxxxx> wrote:

Hi there,

I do work on following regex:
^(.*)_a[0-9](.*).htm$

This should be valid for "test_a9393.htm", but not for "9393.htm" as
ther is no leading _a infront of the number.

Unfortunatelly this also works for the 9393.htm file. Can somebody give
me a hint why the regex also is true for text that does not start with
_a infront of the number?

Thank you for any help,

Merlin


Try this:

^(.*)(_a{1})(\d+).htm$

in your regex you are looking for any instance of _, a  OR a sequence of
numbers.

I think this will search for  zero or more characters, one instance of _a,
then one or more numbers, then .htm.




--
http://www.web-buddha.co.uk

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux