Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Help with some regular expressions

Expand Messages
  • timothy adigun
    Hi Tony, ... d is a digit and represents [0-9], but not just [0-9] but also digits from non-roman scripts, while x{n,m} is for matching repetitions, i.e,
    Message 1 of 3 , Mar 9, 2012
    • 0 Attachment
      Hi Tony,

      On Fri, Mar 9, 2012 at 3:59 AM, Tony <GKillah36@...> wrote:

      > **
      >
      >
      > Hi all,
      >
      > Due to all the slashes and brackets and parentheses involved, it's a bit
      > of a hassle to Google this to get answers.
      >
      > Can someone please tell me what these regular expressions do?
      >
      > 1.) /\d{5,5}/
      >
      \d is a digit and represents [0-9], but not just [0-9] but also digits
      from non-roman scripts, while x{n,m} is for matching repetitions, i.e,
      match x, for atleast "n" number of times, but not more that "m" number of
      times.
      So, like David rightly pointed out, /\d{5}/, will be the correct thing to
      write, showing that you want to match extactly [0-9] "5" times. OR you can
      write /[0-9]{5}/

      >
      > 2.) m/\w\w\w\w\w/
      >
      \w is a word character (alphanumeric or _) and represents [0-9a-zA-Z_],
      but not just [0-9a-zA-Z_] but also digits and characters from non-roman
      script.

      >
      > 3.) s/ //g
      >
      This is using substitution operator to match spaces, and then remove them.

      Please, check:
      perldoc perlrequick
      perldoc perlretut


      >
      > Thank you!
      >
      > Tony
      >
      >
      >



      --
      Tim


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.