Pipe (‘|’) simply means ‘or’. At the one side we have regex for zero or more spaces, on the other side we have nothing – so it will match zero or more spaces or an empty string.
More Related Contents:
- Java Variable Substitution
- Search for keywords and replace them with their abbreviations [closed]
- Regex to match end-of-sentence markers [closed]
- Counting the occurrence of a special character, numbers and letters on a user-specified string
- Extract Substrings using regex Java [closed]
- Remove HTML tags from a String
- What do ^ and $ mean in a regular expression?
- Java – escape string to prevent SQL injection
- Regex for splitting a string using space when not surrounded by single or double quotes
- Java string split with “.” (dot) [duplicate]
- String.replaceAll(regex) makes the same replacement twice
- Rationale for Matcher throwing IllegalStateException when no ‘matching’ method is called
- Is it possible to match nested brackets with a regex without using recursion or balancing groups?
- Escaping special characters in Java Regular Expressions
- java regular expression to extract content within square brackets
- Java regex for support Unicode?
- What is the use of Pattern.quote method?
- Java: Split string when an uppercase letter is found
- How to escape comma and double quote at same time for CSV file?
- Tokenizing Error: java.util.regex.PatternSyntaxException, dangling metacharacter ‘*’
- How to Split a mathematical expression on operators as delimiters, while keeping them in the result?
- Regex that Will Match a Java Method Declaration
- RegEx in Java: how to deal with newline
- Set minimum and maximum characters in a regular expression
- Pattern to extract text between parenthesis
- Java Regex Illegal Escape Character in Character Class
- Regex search with pattern containing (?:.|\s)*? takes increasingly long time
- Regular expression to get an attribute from HTML tag
- Java’s Scanner vs String.split() vs StringTokenizer; which should I use?
- java regex pattern unclosed character class