Содержание
- 2. Agenda What is "Regular Expression"? Creating and running regular expressions in JavaScript Constructing regular expressions: Part
- 3. What is "Regular Expression"?
- 4. Concept of Regular Expressions Regular Expression (Regexp or Regex) is a special sequence of characters that
- 5. Understanding basics Rexes string looks like "cent(er|re)" Each character in Regex may be one of two
- 6. Creating and running regular expressions in JavaScript
- 7. Create RegExp object JavaScript has special object RexExp There are two ways to create an instance
- 8. RegExp flags Regular expressions have four optional flags that allow for global and case insensitive searching.
- 9. RegExp method test() To check if RegExp matches the string we should use test() method of
- 10. String method search() To find index in a string which corresponds match for regular expression we
- 11. String method match() To extract all matches of regular expression from a string, use method match()
- 12. Using Regexes with HTML Forms HTML5 supports special attribute pattern for elements of a form. The
- 13. Constructing Regular Expressions Exact and character set match, basic special characters
- 14. Exact match and anchors Checking for EXACT match of some pattern string inside ANY place of
- 15. Character set match Checking for ONE OR MORE symbols at ANY place in ANY order of
- 16. Negated character set Using caret symbol "^" as first character set symbol "negates" it, change meaning
- 17. Special character: \ A backslash that precedes a non-special character indicates that the next character is
- 18. Symbol ranges How to specify symbol ranges? var re = /[a-z]/; // from a to z
- 19. Pattern . (The decimal point) matches any single character except the newline character. For example, /.n/
- 20. Constructing Regular Expressions Part II: Quantifiers, controlling greedy and non-greedy capturing, capturing groups and logical operators
- 21. Quantifiers and greedy capturing Quantifiers show how many times preceding symbol should appear in the string:
- 22. Quantifier * Matches the preceding character 0 or more times. Equivalent to {0,}. For example, /bo*/
- 23. Quantifier+ Matches the preceding character 1 or more times. Equivalent to {1,}. var re = /bo+/;
- 24. Quantifier ? and switching to non-greedy Matches the preceding character 0 or 1 time. Equivalent to
- 25. Capturing groups and logical operators Round brackets "(",")" used to define capturing groups which mean a
- 26. Useful links
- 27. RegEx101: http://regex101.com Regular Expressions on Mozilla Developer Network: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions RexEgg: http://www.rexegg.com/
- 29. Скачать презентацию