in reply to Re: regex help
in thread regex help

I sure am a perl novice. Its not homework, its a little project script I am working on. sorry, I mistyped that regex, this "$imgNumber =~/^(\d{6})/" not "^(\d)$" is what gave me 012346.jpg. I took care of the .jpg by just recursively printing "$imgNumber.jpg"; and it worked. I was just confused as to how to catch the "-ALL" or "-EXP" "-SAMPLE" part of it with regular expressions. And if possible, I sure would like some teaching on regex. i googled some tut but was still quite confused. Thanks for the help.

Replies are listed 'Best First'.
Re^3: regex help
by ww (Archbishop) on Nov 17, 2004 at 18:15 UTC
    Calypso -- I'm not more'n a step or two ahead of you so forgive any of this which you know and practice already:
    • PREVIEW, PREVIEW, PREVIEW!
    • CUT'n'PASTE FROM TESTED CODE (it doesn't have to work if it's an illustration of a failure, but it does have to be -- verbatim -- what you intended to ask about.
    • Specifically re regexen, since you've reached the point you describe, your next step (IMO) should be to read up on /x, extended format. It really is worth the effort because it makes the regex so readable. Think you'll find good info in perlretut, for which, search or supersearch here. Also will try (when next at home computer) to find some links to some of the better on-line tutorials I stumbled upon.

    And BTW, I have been chastised for using telegraphese (which bears some resemblence to sms texting as practiced by the teen crowd; which association may or may not have been what most annoyed the critics). Nonetheless, they offered other observations which were thoughtful and useful. I, for one, don't wish to impede my communication with them by using forms of which they disapprove, nor by being ambiguous/unclear or inaccurate.

    So I offer you a related (that is, I hope you think it's related) thought: Format your post in a manner that approximates standard syntax and grammar. Structure your notes with paragraphs and typographic conventions that make your message easy to read and follow.... and, above all, make sure you've thought thru, clearly and carefully, just what it is you wish to say.

    A few of us are so elderly or dinosaur-ish as to believe it rude to utter notes shot through with typos....