1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

regular expressions

Discussion in 'Scripting & Programming' started by Davo1977, Jul 6, 2008.

  1. Davo1977

    Davo1977 New Member

    I have been trying my hardest to get to grips with using regular expressions in perl and dont seem to be having any luck with understanding it.

    What I really need is perhaps some real-life examples of were regular expressions have been used. I am a novice and until I can get my hands on some worked examples I will continue to struggle to gain understanding.

    Can anyone advise me on some good examples or simply point me in the right direction? Useful Text Books that are not a waste of money?? or Decent resources??

    Thanks for your advice..
    WIP: CIW Website Design Manager
  2. Mathematix

    Mathematix Megabyte Poster

    Every example is a 'real life' example of an RE. Read around the topic and keep practicing - they don't come easy unless you do. :)
    Certifications: BSc(Hons) Comp Sci, BCS Award of Merit
    WIP: Not doing certs. Computer geek.
  3. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    IMHO an excellent book on REs is "Mastering Regular Expressions" by Friedl and published by O'Reilly.

    I use REs very often, both in Perl and elsewhere.

    One example I use a lot on Unix where docs have come from a Windows box:
    chomp will remove the '\n' from the end of a line, but not the '\r' that Windows uses as well. so I add
    $line =~ s/\r$//;
    to remove it from a line of text.

    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+

Share This Page