Closed Thread Icon

Topic awaiting preservation: regular expression (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=12691" title="Pages that link to Topic awaiting preservation: regular expression (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: regular expression <span class="small">(Page 1 of 1)</span>\

 
maninacan
Paranoid (IV) Inmate

From: Seattle, WA, USA
Insane since: Oct 2001

posted posted 04-12-2003 03:19

can somebody tell me what's wrong with this regular expression ? It's in php.

eregi("^$series$volumenum-[0-9]{3}\.jpg$",$file)

so if $series was set to "Series Name"
and $volumenum was set to "01"
I want it to match any string that would be "Series Name01-xxx.jpg" Where xxx is any 3 digit number.

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 04-12-2003 03:50

In your example "Series Name01-xxx.jpg" you have a space inbetween Series and Name but you don't allow for that in your regexp. Also your regexp will never match unless your target string is on a line by itself.

[edit]

After looking closer at your post and testing a little bit your regexp works the way you have it written for the test text you have supplied. I think the only problem you may have is as I said before. If the text you are looking for is not on a line by itself, it won't match.

[/edit]

-Butcher-

[This message has been edited by butcher (edited 04-12-2003).]

« BackwardsOnwards »

Show Forum Drop Down Menu