Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

What are Regular Expressions in Java | Java Regex Tutorial Edureka

65 views

Published on

YouTube Link:
**Java Certification Training: https://www.edureka.co/java-j2ee-training-course **
This Edureka PPT on "Java Regex " will talk about the various types of regular expressions that will give a head start to beginners with Java regular expressions.
Below topics are covered in this PPT:
What are Regular Expressions?
What is Java Regex?
Matcher Class
Pattern Class
Regex Character Class
Regex Quantifiers
Regex Metacharacters

Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in

Published in: Technology
  • Be the first to comment

What are Regular Expressions in Java | Java Regex Tutorial Edureka

  1. 1. Copyright � 2017, edureka and/or its affiliates. All rights reserved.
  2. 2. WHAT ARE REGULAR EXPRESSIONS? WHAT IS JAVA REGEX? MATCHER CLASS PATTERN CLASS REGEX QUANTIFIERS REGEX METACHARACTERS REGEX CHARACTER CLASS www.edureka.co/java-j2ee-soa-training
  3. 3. www.edureka.co/java-j2ee-soa-training
  4. 4. WHAT ARE REGULAR EXPRESSIONS? A Regular Expression is a sequence of characters that constructs a search pattern. When you search for data in a text, you can use this search pattern to describe what you are looking for. www.edureka.co/java-j2ee-soa-training
  5. 5. www.edureka.co/java-j2ee-soa-training
  6. 6. WHAT IS JAVA REGEX? The Java Regex is an API which is used to define a pattern for searching or manipulating Strings. It is widely used to define the constraint on Strings such as password and email validation. www.edureka.co/java-j2ee-soa-training
  7. 7. www.edureka.co/java-j2ee-soa-training
  8. 8. MATCHER CLASS boolean matches() Tests whether the given regular expression matches or not boolean find() Used to find the next expression that matches the pattern boolean find(int start) Searches the next expression from the given start number String group() Used to return the matched sequence int start() Returns the starting index int end() Returns the ending index int groupCount() Returns the total number of the matched sequence www.edureka.co/java-j2ee-soa-training
  9. 9. www.edureka.co/java-j2ee-soa-training
  10. 10. PATTERN CLASS Static Pattern compile(String regex) It compiles the given regex and returns the instance of a pattern Matcher matcher(charSequence input) Used to create a matcher that matches the given input with the pattern Static boolean matches(String regex) It works as a combination of compile and matcher methods. String split[] Used to split the given String around matches of a given pattern String pattern() Helps to return the regex pattern Int end() Returns the ending index www.edureka.co/java-j2ee-soa-training
  11. 11. www.edureka.co/java-j2ee-soa-training
  12. 12. REGEX CHARACTER CLASS [abc] a,b or c (A Simple class) [^abc] Any class except a, b or c (negation) [a-zA-Z] A through Z or a trough z inclusive (Range) [a-d[m-p]] a through d or m through p (union) [a-z&&[def]] d,e, or f (Intersection) [a-z&&[^bc]] A through z except b or c (Subtraction) [a-z&&[^m-p]] A through z and not m through p (Subtraction) www.edureka.co/java-j2ee-soa-training
  13. 13. www.edureka.co/java-j2ee-soa-training
  14. 14. REGEX QUANTIFIERS X? X occurs once or not at all X+ X occurs more than one times X* X occurs zero or more times X{n} X occurs n times only X{n,} X occurs n or more times only www.edureka.co/java-j2ee-soa-training X{y,z} X occurs at least y times but less than z times
  15. 15. www.edureka.co/java-j2ee-soa-training
  16. 16. REGEX METACHARACTERS . It can be any character d Represents any digits D Represents any non digit s Represents any white space S Non white space character w It can be a word character b Represents a word boundary W It can be a word character B It represents a non word boundary www.edureka.co/java-j2ee-soa-training
  17. 17. Copyright � 2019, edureka and/or its affiliates. All rights reserved.
  18. 18. www.edureka.co/java-j2ee-soa-training

×