Notes on Regular Expression

  1. What is the difference between “*” and “+”?
    “*” will match the character zero or more times whereas “+” will match one or more times. For example, “\d*” regular expression will return the following results for:

    • 2b – will match “2b”
    • 3ab – will match “b” (since digit character is optional)

    Now consider “\d+” regular expression:

    • 2b – will still match “2b”
    • 3ab –¬†will not return any match as “+” required one or more times matches.
  2. <continue…>

Leave a Reply

Your email address will not be published. Required fields are marked *