regular expressions reminder commonly used special
play

Regular Expressions Reminder: Commonly used special symbols in - PowerPoint PPT Presentation

Regular Expressions Reminder: Commonly used special symbols in Python regular expressions Symbol Meaning . matches any character + 1 or more * 0 or more () capture group \d digit \D non-digit \s whitespace \S non-whitespace \w


  1. Regular Expressions

  2. Reminder: Commonly used special symbols in Python regular expressions Symbol Meaning . matches any character + 1 or more * 0 or more () capture group \d digit \D non-digit \s whitespace \S non-whitespace \w alphanumeric \W non-alphanumeric

  3. Character sets: [abcd] matches the letters a, b, c, d

  4. Character sets: [abcd] matches the letters a, b, c, d String: gray Regex: gr[abcd]y

  5. Character sets: [abcd] matches the letters a, b, c, d String: gray Regex: gr[abcd]y Match: gray

  6. Character sets: [abcd] matches the letters a, b, c, d String: grey Regex: gr[abcd]y

  7. Character sets: [abcd] matches the letters a, b, c, d String: grey Regex: gr[abcd]y Match: Does not match!

  8. A character set matches exactly one letter String: -ATGGTCTA- Regex: -[ATGC]-

  9. A character set matches exactly one letter String: -ATGGTCTA- Regex: -[ATGC]- Match: Does not match!

  10. A character set matches exactly one letter String: -ATGGTCTA- Regex: -[ATGC]+-

  11. A character set matches exactly one letter String: -ATGGTCTA- Regex: -[ATGC]+- Match: -ATGGTCTA-

  12. Negative character sets: [^abcd] matches anything but a, b, c, d String: gray Regex: gr[^abcd]y

  13. Negative character sets: [^abcd] matches anything but a, b, c, d String: gray Regex: gr[^abcd]y Match: Does not match!

  14. Negative character sets: [^abcd] matches anything but a, b, c, d String: grey Regex: gr[^abcd]y

  15. Negative character sets: [^abcd] matches anything but a, b, c, d String: grey Regex: gr[^abcd]y Match: grey

Recommend


More recommend