In this chapter, you learned how to capture and reference substrings from an input text using regular expressions. Using non-capturing groups, we discussed how to optimize our regex patterns. We discussed the various types of groups available in Java regular expressions, the numbering of captured groups, and named groups. You also learned how to use back reference and forward reference of the capturing groups using numbered and named references. In the next chapter, you will get to writing code in Java to evaluate regular expressions. You will also be introduced to Java regular expressions using the Java String API, and then, we will move on to regex capabilities in the Java Scanner API.