Regular Expressions

Поделиться
HTML-код
  • Опубликовано: 25 янв 2025

Комментарии • 19

  • @gb590212h
    @gb590212h 11 лет назад +3

    3. In slide 22, the regexp given will not match any of the example lines shown, but
    [Bb]ush( +[^ ]+){1,5} debate
    will. (The difference is that the repeated pattern in this one does not end with " +".)

    • @jxy4239
      @jxy4239 7 лет назад

      thanks - answered my question

    • @aaljaish100
      @aaljaish100 5 лет назад

      Thank you, I literally was working on this issue for several hours thinking I was doing something wrong...apparently I was not...

  • @gb590212h
    @gb590212h 11 лет назад +7

    There are several significant errors in this lecture.
    1. In slide 13, the explanation given for why the regular expression matches the last line is incorrect. The "." matches exactly one character. It will never match an empty string. In the case of the last line in that slide, the regular expression matches the substring "9911" of the line, and therefore, the "." is matching the second 9 of this substring.

    • @lalaithan
      @lalaithan 6 лет назад +1

      He definitely teaches this better than Jeff Leek (professor in the same dept), in my humble opinion.

  • @gb590212h
    @gb590212h 11 лет назад +3

    4. The parenthesized subexpressions (of the given example lines) matched by the regular expressions given in slides 26 and 27 will be identical (contrary to what Prof. Peng implies). This is because the regular expression in slide 27, namely,
    ^s(.*?)s$
    has an end-of-line anchor ($) at the end, and all the example lines happen to end with the character "s". Therefore, as far as these examples is concerned, the "?" modifier (which is the subject of slide 27) will actually have no effect.

  • @gb590212h
    @gb590212h 11 лет назад +4

    2. Slide 20 is misleading because it suggests that the given regular expression will match only lines that contain a "(" followed by a ")" (with 0 or more arbitrary characters in-between). The fact is that that regular expression will match *any* line whatsoever, whether it includes parentheses or not. The regular expression that represents your examples would be
    \(.*\)
    or, better yet,
    \([^)]*\)

  • @wessauder7708
    @wessauder7708 9 лет назад +1

    Great walkthrough - I've been forcing my way through this subject for awhile, but I'm glad I finally took the time to properly walk through slowly with good explanations. As usual, your presentations are always gentle to absorb and not overwhelming! Thanks for the link to this in your rPub book 'R Programming for Data Science' which is equally well done.

  • @1234tombaker
    @1234tombaker Год назад

    Why, between slides 20 and 21, does the (.*) suddenly NOT refer to open or closed parentheses? I.e. the thing being searched for (with anything or nothing in the middle).
    There are no parentheses in slide 21 but it only means anything between a numeric.

    • @stewarttoop4031
      @stewarttoop4031 Год назад +1

      @gb590212h
      10 years ago
      2. Slide 20 is misleading because it suggests that the given regular expression will match only lines that contain a "(" followed by a ")" (with 0 or more arbitrary characters in-between). The fact is that that regular expression will match *any* line whatsoever, whether it includes parentheses or not. The regular expression that represents your examples would be
      \(.*\)
      or, better yet,
      \([^)]*\)

  • @TiffanyNg100
    @TiffanyNg100 3 года назад

    really clear to understand thanks

  • @otraperspectiva
    @otraperspectiva 6 лет назад +1

    Thank you very much for this!

  • @Rsingh1
    @Rsingh1 3 года назад

    Thanks

  • @georgigeorgiev2219
    @georgigeorgiev2219 9 лет назад

    Thank you.
    GOD bless you.

  • @girishreddyedula2667
    @girishreddyedula2667 6 лет назад

    can i get sample code