{"id":5295,"date":"2023-10-26T13:09:23","date_gmt":"2023-10-26T20:09:23","guid":{"rendered":"https:\/\/ioflood.com\/blog\/?p=5295"},"modified":"2024-02-26T13:54:45","modified_gmt":"2024-02-26T20:54:45","slug":"java-regex","status":"publish","type":"post","link":"https:\/\/ioflood.com\/blog\/java-regex\/","title":{"rendered":"Mastering Java Regex: Guide to Pattern Matching and More"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2023\/10\/java_regex_pattern_match_letters-300x300.jpg\" alt=\"java_regex_pattern_match_letters\" width=\"300\" height=\"300\" title=\"\"><\/figure>\n<\/div>\n<p>Are you finding it difficult to match patterns in Java? You&#8217;re not alone. Many developers find Java&#8217;s regex (short for regular expressions) a bit of a puzzle, but we&#8217;re here to help.<\/p>\n<p>Think of Java&#8217;s regex as a detective &#8211; it can help you find patterns in your data, making it an invaluable tool for various tasks.<\/p>\n<p><strong>In this guide, we&#8217;ll walk you through the basics of Java regex and even delve into advanced usage scenarios.<\/strong> We&#8217;ll cover everything from using the <code>Pattern<\/code> and <code>Matcher<\/code> classes, to handling complex regex patterns and alternative approaches.<\/p>\n<p>So, let&#8217;s get started and master Java regex!<\/p>\n<h2>TL;DR: How Do I Use Regex in Java?<\/h2>\n<blockquote><p>\n  To utilize Regex you must first import the <code>java.util.regex<\/code> package with, <code>import java.util.regex.*;<\/code>. Then you will need to define the <code>Pattern<\/code> and <code>Matcher<\/code> classes with the syntax, <code>Pattern pattern = Pattern.compile('initialPattern')<\/code> and <code>Matcher matcher = pattern.matcher('patternto');<\/code>.\n<\/p><\/blockquote>\n<p>Here&#8217;s a simple example:<\/p>\n<pre><code class=\"language-java line-numbers\">import java.util.regex.*;\n\nPattern pattern = Pattern.compile('ab');\nMatcher matcher = pattern.matcher('abc');\nboolean matches = matcher.matches();\n\n\/\/ Output:\n\/\/ true\n<\/code><\/pre>\n<p>In this example, we import the <code>java.util.regex<\/code> package and create a <code>Pattern<\/code> object by compiling a simple regex pattern &#8216;ab&#8217;. We then create a <code>Matcher<\/code> object by applying the pattern to a string &#8216;abc&#8217;. The <code>matches()<\/code> method checks if the string matches the pattern, and in this case, it returns true because &#8216;abc&#8217; starts with &#8216;ab&#8217;.<\/p>\n<blockquote><p>\n  This is just a basic way to use regex in Java, but there&#8217;s much more to learn about pattern matching and handling complex regex patterns. Continue reading for a deeper understanding and more advanced usage scenarios.\n<\/p><\/blockquote>\n<h2>Basic Use of Java Regex<\/h2>\n<p>Java Regex, or Regular Expressions, is a powerful tool that allows you to match, locate, and manage text. The <code>java.util.regex<\/code> package provides the necessary classes for pattern matching using regex in Java. The two main classes we&#8217;ll focus on are <code>Pattern<\/code> and <code>Matcher<\/code>.<\/p>\n<h3>The <code>Pattern<\/code> Class<\/h3>\n<p>The <code>Pattern<\/code> class, as the name suggests, represents a compiled representation of a regular expression. You create a <code>Pattern<\/code> object by invoking the <code>Pattern.compile()<\/code> method and passing the regex pattern as a string.<\/p>\n<h3>The <code>Matcher<\/code> Class<\/h3>\n<p>The <code>Matcher<\/code> class, on the other hand, is the engine that interprets the pattern and performs match operations against an input string. You create a <code>Matcher<\/code> object by invoking the <code>matcher()<\/code> method on a <code>Pattern<\/code> object.<\/p>\n<p>Let&#8217;s see these classes in action:<\/p>\n<pre><code class=\"language-java line-numbers\">import java.util.regex.*;\n\n\/\/ Create a Pattern object\nPattern pattern = Pattern.compile('ab');\n\n\/\/ Create a Matcher object\nMatcher matcher = pattern.matcher('abcde');\n\n\/\/ Check if the pattern matches the input string\nboolean matches = matcher.matches();\n\nSystem.out.println(matches);\n\n\/\/ Output:\n\/\/ false\n<\/code><\/pre>\n<p>The above code does not return a match because the <code>matches()<\/code> method attempts to match the entire input string against the pattern. Our pattern &#8216;ab&#8217; does not match the entire string &#8216;abcde&#8217;, hence, it returns false.<\/p>\n<p>If you want to check if the input string contains the pattern, you can use the <code>find()<\/code> method of the <code>Matcher<\/code> class:<\/p>\n<pre><code class=\"language-java line-numbers\">boolean found = matcher.find();\n\nSystem.out.println(found);\n\n\/\/ Output:\n\/\/ true\n<\/code><\/pre>\n<p>The <code>find()<\/code> method scans the input string for the pattern &#8216;ab&#8217; and returns true because &#8216;ab&#8217; is found in &#8216;abcde&#8217;.<\/p>\n<h2>Advanced Java Regex Patterns<\/h2>\n<p>As you become more comfortable with Java regex, you can start exploring more complex patterns. These include quantifiers, character classes, and boundary matchers.<\/p>\n<h3>Harnessing Quantifiers<\/h3>\n<p>Quantifiers determine how many instances of a character, group, or character class must be present in the input for a match to be found. Here are some common quantifiers:<\/p>\n<ul>\n<li><code>*<\/code> Zero or more times<\/li>\n<li><code>+<\/code> One or more times<\/li>\n<li><code>?<\/code> Zero or one time<\/li>\n<li><code>{n}<\/code> Exactly n times<\/li>\n<li><code>{n,}<\/code> At least n times<\/li>\n<li><code>{n,m}<\/code> At least n but not more than m times<\/li>\n<\/ul>\n<p>Here&#8217;s an example of how to use quantifiers:<\/p>\n<pre><code class=\"language-java line-numbers\">Pattern pattern = Pattern.compile('a*');\nMatcher matcher = pattern.matcher('aaaaab');\nboolean matches = matcher.matches();\n\nSystem.out.println(matches);\n\n\/\/ Output:\n\/\/ false\n<\/code><\/pre>\n<p>In the above code, the pattern &#8216;a*&#8217; matches zero or more &#8216;a&#8217; characters. However, the <code>matches()<\/code> method returns false because it tries to match the entire string, and our string ends with &#8216;b&#8217;.<\/p>\n<h3>Exploring Character Classes<\/h3>\n<p>Character classes represent a set of characters, and any character from the set can match. For instance, <code>[abc]<\/code> matches &#8216;a&#8217;, &#8216;b&#8217;, or &#8216;c&#8217;.<\/p>\n<pre><code class=\"language-java line-numbers\">Pattern pattern = Pattern.compile('[abc]*');\nMatcher matcher = pattern.matcher('abc');\nboolean matches = matcher.matches();\n\nSystem.out.println(matches);\n\n\/\/ Output:\n\/\/ true\n<\/code><\/pre>\n<p>In this example, the pattern &#8216;[abc]*&#8217; matches any sequence (including an empty one) of &#8216;a&#8217;, &#8216;b&#8217;, or &#8216;c&#8217; characters. Therefore, the string &#8216;abc&#8217; matches the pattern.<\/p>\n<h3>Utilizing Boundary Matchers<\/h3>\n<p>Boundary matchers help you find a particular word or a pattern at the start or end of a line. Some common boundary matchers are <code>^<\/code> (start of a line) and <code>$<\/code> (end of a line).<\/p>\n<pre><code class=\"language-java line-numbers\">Pattern pattern = Pattern.compile('^a.*b$');\nMatcher matcher = pattern.matcher('abc');\nboolean matches = matcher.matches();\n\nSystem.out.println(matches);\n\n\/\/ Output:\n\/\/ true\n<\/code><\/pre>\n<p>In this example, the pattern &#8216;^a.*b$&#8217; matches any string that starts with &#8216;a&#8217; and ends with &#8216;b&#8217;. Therefore, the string &#8216;abc&#8217; matches the pattern.<\/p>\n<h2>Alternative Pattern Matching Methods in Java<\/h2>\n<p>Java offers more ways to perform pattern matching beyond the <code>Pattern<\/code> and <code>Matcher<\/code> classes. Let&#8217;s explore two such alternatives: the <code>String.matches()<\/code> method and third-party libraries like Apache Commons Lang.<\/p>\n<h3>Java&#8217;s <code>String.matches()<\/code> Method<\/h3>\n<p>Java&#8217;s String class has a <code>matches()<\/code> method that takes a regex pattern as a parameter and checks if the string matches the pattern. It&#8217;s a quick and easy way to perform pattern matching, especially for simple patterns.<\/p>\n<pre><code class=\"language-java line-numbers\">String str = 'abc';\nboolean matches = str.matches('abc');\n\nSystem.out.println(matches);\n\n\/\/ Output:\n\/\/ true\n<\/code><\/pre>\n<p>In the example above, we use the <code>matches()<\/code> method of the String class to check if the string &#8216;abc&#8217; matches the pattern &#8216;abc&#8217;. The method returns true, indicating a match.<\/p>\n<h3>Apache Commons Lang Library<\/h3>\n<p>Apache Commons Lang is a third-party library that provides helper utilities for the java.lang API, including pattern matching. The <code>StringUtils<\/code> class, for example, has several methods for string manipulation and pattern matching.<\/p>\n<pre><code class=\"language-java line-numbers\">import org.apache.commons.lang3.StringUtils;\n\nString str = 'abc';\nboolean contains = StringUtils.contains(str, 'a');\n\nSystem.out.println(contains);\n\n\/\/ Output:\n\/\/ true\n<\/code><\/pre>\n<p>In this example, we use the <code>contains()<\/code> method of the <code>StringUtils<\/code> class to check if the string &#8216;abc&#8217; contains the character &#8216;a&#8217;. The method returns true, indicating the character is present.<\/p>\n<p>Here&#8217;s a comparison of the three methods we&#8217;ve discussed:<\/p>\n<table>\n<thead>\n<tr>\n<th>Method<\/th>\n<th>Complexity<\/th>\n<th>Use Case<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>Pattern<\/code> and <code>Matcher<\/code> classes<\/td>\n<td>High<\/td>\n<td>Powerful and flexible, suitable for complex pattern matching<\/td>\n<\/tr>\n<tr>\n<td><code>String.matches()<\/code> method<\/td>\n<td>Medium<\/td>\n<td>Quick and easy, suitable for simple pattern matching<\/td>\n<\/tr>\n<tr>\n<td>Apache Commons Lang<\/td>\n<td>Low<\/td>\n<td>Provides many helper methods, suitable for string manipulation and pattern matching<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>These alternative methods provide additional flexibility when working with Java regex, allowing you to choose the method that best suits your use case.<\/p>\n<h2>Troubleshooting Java Regex<\/h2>\n<p>While Java regex is a powerful tool, it does come with its own set of challenges. Let&#8217;s discuss some common issues you might encounter when using regex in Java, and how to solve them.<\/p>\n<h3>Pattern Syntax Exceptions<\/h3>\n<p>A <code>PatternSyntaxException<\/code> is a type of unchecked exception that Java throws when the syntax of the regex pattern is incorrect.<\/p>\n<pre><code class=\"language-java line-numbers\">try {\n    Pattern pattern = Pattern.compile('*ab');\n} catch (PatternSyntaxException e) {\n    System.out.println('Invalid regex pattern');\n}\n\n\/\/ Output:\n\/\/ Invalid regex pattern\n<\/code><\/pre>\n<p>In this example, the pattern &#8216;<em>ab&#8217; is invalid because the &#8216;<\/em>&#8216; quantifier doesn&#8217;t have a valid preceding expression. The <code>Pattern.compile()<\/code> method throws a <code>PatternSyntaxException<\/code>, which we catch and handle by printing a custom error message.<\/p>\n<h3>Performance Considerations<\/h3>\n<p>Regex can be slow, especially for complex patterns or long strings. This can impact your application&#8217;s performance. One way to mitigate this is by using the <code>Pattern<\/code> class&#8217;s <code>compile()<\/code> method to create a precompiled pattern. This pattern can then be reused, saving the cost of compiling the pattern each time it&#8217;s used.<\/p>\n<pre><code class=\"language-java line-numbers\">Pattern pattern = Pattern.compile('ab');\n\nfor (int i = 0; i &lt; 1000; i++) {\n    Matcher matcher = pattern.matcher('abc' + i);\n    boolean matches = matcher.matches();\n}\n<\/code><\/pre>\n<p>In the above example, we compile the pattern &#8216;ab&#8217; once and reuse it in a loop. This is more efficient than compiling the pattern inside the loop.<\/p>\n<p>Remember, while Java regex is powerful, it&#8217;s not always the best tool for the job. If you&#8217;re dealing with simple patterns or string manipulation tasks, consider using String methods or third-party libraries like Apache Commons Lang.<\/p>\n<h2>Understanding Regular Expressions<\/h2>\n<p>Regular Expressions, commonly known as regex, are a powerful tool in programming that allow for complex pattern matching and manipulation of text. They are essentially a sequence of characters that form a search pattern.<\/p>\n<h3>The Syntax of Regex<\/h3>\n<p>Regex has its own unique syntax that can be broken down into several elements:<\/p>\n<ul>\n<li><strong>Literal Characters<\/strong>: These are standard characters that match themselves exactly.<\/p>\n<\/li>\n<li>\n<p><strong>Metacharacters<\/strong>: These characters have special meanings, like <code>{}<\/code>, <code>()<\/code>, <code>.<\/code>, <code>^<\/code>, <code>$<\/code>, <code>|<\/code>, <code>*<\/code>, <code>+<\/code>, <code>?<\/code>, and <code>[]<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>Quantifiers<\/strong>: These define how many times a character, group, or character class must be present for a match. Examples include <code>{}<\/code>, <code>*<\/code>, <code>+<\/code>, and <code>?<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>Character Classes<\/strong>: These represent a set of characters. For instance, <code>[abc]<\/code> matches any character that is either &#8216;a&#8217;, &#8216;b&#8217;, or &#8216;c&#8217;.<\/p>\n<\/li>\n<li>\n<p><strong>Escape Sequences<\/strong>: These are denoted by a backslash (<code>\\<\/code>) followed by the character you want to match. For instance, <code>\\d<\/code> matches any digit.<\/p>\n<\/li>\n<\/ul>\n<p>Here&#8217;s a simple example of a regex pattern:<\/p>\n<pre><code class=\"language-java line-numbers\">Pattern pattern = Pattern.compile('[a-z]+');\nMatcher matcher = pattern.matcher('abc');\nboolean matches = matcher.matches();\n\nSystem.out.println(matches);\n\n\/\/ Output:\n\/\/ true\n<\/code><\/pre>\n<p>In this example, the pattern <code>[a-z]+<\/code> matches any sequence of one or more lowercase letters. The string &#8216;abc&#8217; matches this pattern, so the <code>matches()<\/code> method returns true.<\/p>\n<h3>Structure of Regex Patterns<\/h3>\n<p>Regex patterns can be simple, matching specific sequences of characters, or complex, using metacharacters and quantifiers to match a wide range of strings. The structure of your regex pattern will depend on what you&#8217;re trying to achieve.<\/p>\n<p>Understanding the fundamentals of regex is crucial when working with Java regex. It provides the foundation upon which you can build more complex pattern matching scenarios and effectively manipulate text in your Java programs.<\/p>\n<h2>The Power of Java Regex Beyond Pattern Matching<\/h2>\n<p>Java regex is not just about pattern matching. It&#8217;s a powerful tool that can be used in various other aspects of programming, such as data validation, search and replace operations, and text processing.<\/p>\n<h3>Data Validation with Java Regex<\/h3>\n<p>Data validation is a common use case for regex. You can use regex to check if a string matches a specific format, such as an email address or phone number.<\/p>\n<pre><code class=\"language-java line-numbers\">Pattern pattern = Pattern.compile('^\\w+@[a-zA-Z_]+?\\.[a-zA-Z]{2,3}$');\nMatcher matcher = pattern.matcher('user@example.com');\nboolean matches = matcher.matches();\n\nSystem.out.println(matches);\n\n\/\/ Output:\n\/\/ true\n<\/code><\/pre>\n<p>In this example, we use regex to validate an email address. The pattern <code>^\\w+@[a-zA-Z_]+?\\.[a-zA-Z]{2,3}$<\/code> checks if the string is a valid email address, and in this case, &#8216;user@example.com&#8217; is valid, so the <code>matches()<\/code> method returns true.<\/p>\n<h3>Search and Replace Operations<\/h3>\n<p>Regex can also be used to perform search and replace operations in a string. For instance, you can use the <code>replaceAll()<\/code> method of the <code>String<\/code> class to replace all occurrences of a pattern in a string.<\/p>\n<pre><code class=\"language-java line-numbers\">String str = 'The quick brown fox jumps over the lazy dog.';\nString replacedStr = str.replaceAll('fox', 'cat');\n\nSystem.out.println(replacedStr);\n\n\/\/ Output:\n\/\/ 'The quick brown cat jumps over the lazy dog.'\n<\/code><\/pre>\n<p>In this example, we use regex to replace &#8216;fox&#8217; with &#8216;cat&#8217; in the string.<\/p>\n<h3>Text Processing with Java Regex<\/h3>\n<p>Regex is also useful for text processing tasks, such as splitting a string into tokens. You can use the <code>split()<\/code> method of the <code>String<\/code> class to split a string around matches of a regex pattern.<\/p>\n<pre><code class=\"language-java line-numbers\">String str = 'apple,banana,cherry';\nString[] fruits = str.split(',');\n\nfor (String fruit : fruits) {\n    System.out.println(fruit);\n}\n\n\/\/ Output:\n\/\/ 'apple'\n\/\/ 'banana'\n\/\/ 'cherry'\n<\/code><\/pre>\n<p>In this example, we use regex to split a string into an array of substrings.<\/p>\n<h3>Further Resources for Mastering Java Regex<\/h3>\n<p>If you&#8217;re interested in learning more about Java regex, here are some resources you might find helpful:<\/p>\n<ul>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/java-string\/\">Exploring Java String Manipulation: Essential Techniques<\/a> &#8211; Learn essential methods for working with strings in Java.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/indexof-java\/\">Finding Substrings in Java<\/a> &#8211; Master using indexOf() for string manipulation, searching, and pattern matching in Java<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/java-pattern\/\">Patterns in Java<\/a> &#8211; Learn about the Pattern class in Java for compiling and working with regular expressions.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/essential\/regex\/\" target=\"_blank\" rel=\"noopener\">Java&#8217;s Official Regular Expressions Tutorial<\/a> &#8211; Gain official insights into handling regular expressions in Java.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.tutorialspoint.com\/java\/java_regular_expressions.htm\" target=\"_blank\" rel=\"noopener\">Java Regex Tutorial<\/a> by Tutorialspoint covers handling Java regular expressions.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.baeldung.com\/regular-expressions-java\" target=\"_blank\" rel=\"noopener\">Java Regular Expressions<\/a> &#8211; Explore regular expressions in Java with Baeldung&#8217;s expert guide.<\/p>\n<\/li>\n<\/ul>\n<p>These resources provide in-depth tutorials and examples that can help you master Java regex.<\/p>\n<h2>Wrapping Up: Regex in Java<\/h2>\n<p>In this comprehensive guide, we&#8217;ve delved deep into the world of Java Regex, a powerful tool for pattern matching and text manipulation in Java.<\/p>\n<p>We began with the basics, learning how to use the <code>Pattern<\/code> and <code>Matcher<\/code> classes for simple pattern matching. We then ventured into more advanced territory, exploring complex regex patterns using quantifiers, character classes, and boundary matchers. We also discussed alternative approaches, such as Java&#8217;s <code>String.matches()<\/code> method and third-party libraries like Apache Commons Lang.<\/p>\n<p>Along the way, we tackled common challenges you might face when using Java regex, such as pattern syntax exceptions and performance considerations, providing you with solutions and workarounds for each issue.<\/p>\n<p>Here&#8217;s a quick comparison of the methods we&#8217;ve discussed:<\/p>\n<table>\n<thead>\n<tr>\n<th>Method<\/th>\n<th>Complexity<\/th>\n<th>Use Case<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>Pattern<\/code> and <code>Matcher<\/code> classes<\/td>\n<td>High<\/td>\n<td>Powerful and flexible, suitable for complex pattern matching<\/td>\n<\/tr>\n<tr>\n<td><code>String.matches()<\/code> method<\/td>\n<td>Medium<\/td>\n<td>Quick and easy, suitable for simple pattern matching<\/td>\n<\/tr>\n<tr>\n<td>Apache Commons Lang<\/td>\n<td>Low<\/td>\n<td>Provides many helper methods, suitable for string manipulation and pattern matching<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Whether you&#8217;re just starting out with Java regex or you&#8217;re looking to level up your pattern matching skills, we hope this guide has given you a deeper understanding of Java regex and its capabilities.<\/p>\n<p>With its balance of power, flexibility, and ease of use, Java regex is an invaluable tool for any Java developer. Happy coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you finding it difficult to match patterns in Java? You&#8217;re not alone. Many developers find Java&#8217;s regex (short for regular expressions) a bit of a puzzle, but we&#8217;re here to help. Think of Java&#8217;s regex as a detective &#8211; it can help you find patterns in your data, making it an invaluable tool for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9697,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[154,121],"tags":[],"class_list":["post-5295","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","category-programming-coding","cat-154-id","cat-121-id","has_thumb"],"_links":{"self":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/5295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/comments?post=5295"}],"version-history":[{"count":9,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/5295\/revisions"}],"predecessor-version":[{"id":17656,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/5295\/revisions\/17656"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media\/9697"}],"wp:attachment":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media?parent=5295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/categories?post=5295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/tags?post=5295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}