Home

Java regex cheat sheet

Java Regular Expressions Cheat Sheet (Regex Java) JRebel

  1. Then, at the end of the article, we provide a Java RegEx cheat sheet PDF that gives you all RegEx shortcuts on one page. But first, let's start with the basics. What Is a Java Regular Expression? A Java regular expression, or Java regex, is a sequence of characters that specifies a pattern which can be searched for in a text
  2. Java Regular Expressions Cheat Sheet Author: Eric Stewart Created Date: 6/4/2005 12:02:39 AM.
  3. A regular expression, or regex, is a sequence of characters that specifies a pattern which can be searched for in a text. A regex defines a set of strings, usually united for a given purpose. About Our Java Regex Cheat Sheet This cheat sheet contains the most useful classes, API, and syntax definitions for Java regex, including
  4. Quick-Start: Regex Cheat Sheet. The tables below are a reference to basic regex. While reading the rest of the site, when in doubt, you can always come back and look here. (It you want a bookmark, here's a direct link to the regex reference tables ). I encourage you to print the tables so you have a cheat sheet on your desk for quick reference
  5. Java Regex Cheat Sheet # java # regex # codenewbie # beginners. Juneau Lim. Juneau Lim. Juneau Lim. Follow. full discloser: #CodeNewbie #horribleAtHumanLanguage Location Kinda GTA education Software Development Joined May 10, 2019. May 12, 2019 ・Updated on Jun 4.
  6. 5hjxodu ([suhvvlrqv fkhdw vkhhw %dvlf pdwfklqj (dfk v\pero pdwfkhv d vlqjoh fkdudfwhu dq\wklqj =egljlw lq =%qrq gljlw =x´zrugµ ohwwhuv dqg gljlwv dqg

  1. Regular expression syntax cheatsheet This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide
  2. Java Regex Cheat Sheet (taken from: http://stackoverflow.com/questions/3847294/replace-all-characters-not-in-range-java-string) - regex cheatsheet
  3. Java regular expression cheat sheet pdf. A java regular expression or java regex is a sequence of characters that specifies a pattern which can be searched for in a text. It you want a bookmark here s a direct link to the regex reference tables i encourage you to print the tables so you have a cheat sheet on your desk for quick reference
  4. JavaScript regular expressions cheatsheet and examples. 2020-07-20. Above diagram created using Regulex. This blog post gives an overview of regular expression syntax and features supported by JavaScript. Examples have been tested on Chrome/Chromium console (version 81+) and includes features not available in other browsers and platforms

Java Regular Expressions Cheat Sheet JRebel & XRebel by

Regex Cheat Sheet. Probably the Best Regular Expression Cheat Sheet on the Net. The most commonly used metacharacters in Python, PHP, Perl, JavaScript, and Ruby. Download as PDF. Metacharacter Meaning \n: Newline [] Range or character class [^] Not in range or negated character class. (dot or point) Any character except newline \w: Word character [a-zA-Z0-9_] \W: Nonword character [^a-zA. Java Programming Cheatsheet. We summarize the most commonly used Java language features and APIs in the textbook. Hello, World. Editing, compiling, and executing. Built-in data types. Declaration and assignment statements. Integers. Floating-point numbers. Booleans. Comparison operators. Printing. Parsing command-line arguments. Math library Regex; Linux; HTML; HTML-DOM; mod_rewrite; Even More » OverAPI.com. Python; jQuery; NodeJS; PHP; Java; Ruby; Javascript; ActionScript; CSS; Express; More » Loading... Anchors. Anchros ^ Start of string, or start of line in multi-line pattern \A; Start of string $ End of string, or end of line in multi-line pattern \Z; End of string \b; Word boundary \B; Not word boundary \< Start of word. Regular Expressions Cheat Sheet A quick reference guide for regular expressions (regex), including symbols, ranges, grouping, assertions and some sample patterns to get you started

Regex Cheat Sheet - rexegg

Regex cheat sheet is a quick reference for study and work. Home. Programing Gaming Education Business Marketing Software. New. Regex Cheat Sheet. A regular expression is a sequence of characters that specifies a search pattern. Regex cheat sheet is a quick reference for study and work. Select. More Characters. Character Legend Example Sample Match. Any character except line break: a.c: abc. Java regex cheat sheet pdf Javascript regex cheat sheet. Java 8 regex cheat sheet. This page provides a general cheat sheet of all regexpã functionality, Bya aggregating syntax, the content of the articles contained in the RegexP Guide. If you need more information on a specific topic, follow the link on the item corresponding to access the complete article or head for the guide.character. REGEX CHEAT SHEET The most commonly used metacharacters in Python, PHP, Perl, JavaScript, and Ruby regular expressions Metacharacters Meaning \n Newline [] Range or character class [^] Not in range or negated character class. (dot or point) Any character except newline \w Word character [a-zA-Z0-9_] \W Nonword character [^a-zA-Z0-9_] \d Digit character [0-9] \D Nondigit character [^0-9.

Welcome to RegExLib.com, the Internet's first Regular Expression Library.Currently we have indexed 4149 expressions from 2818 contributors around the world. We hope you'll find this site useful and come back whenever you need help writing an expression, you're looking for an expression for a particular task, or are ready to contribute new expressions you've just figured out Find the Java Regex Cheat Sheet, including hundreds of ways to cook meals to eat. May the forces of evil become confused on your path to success. Video about Java Regex Cheat Sheet. Follow to get the latest 2021 recipes, articles and more! Java Regex Hackerrank Solution; Java Regex Matcher ; Recipe: Delicious Mocha - Java Milkshake. By darylfarahi Posted on June 22, 2021. Mocha - Java.

This is a regular expressions cheat sheet which you can refer to when trying to remember how a method, special character or flag works. Defining a Regular Expression in JavaScript. There are two ways of defining a regular expression in JavaScript. var rgx = /^(\d+) / — You can use a regular expression literal and enclose the pattern between slashes. This is evaluated at compile time and. Mar 29, 2017 - Our Java regular expression cheat sheet offers the correct syntax for Java RegEx, including classes and methods, boundary matchers, quantifiers, and more

Java Regex Cheat Sheet - DEV Communit

Blog > Community > Regex Cheat Sheet (Regular Expressions) Regex Cheat Sheet (Regular Expressions) Last Updated on September 14, 2020 by RapidAPI Staff Leave a Comment. Regular Expression or regex is a text string that permits developers to build a pattern that can help them match, manage, and locate text. Mastering regex can save programmers thousands of hours when working with a text or when. Regex cheatsheet. Many programs use regular expression to find & replace text. However, they tend to come with their own different flavor. You can probably expect most modern software and programming languages to be using some variation of the Perl flavor, PCRE; however command-line tools (grep, less,) will often use the POSIX flavor (sometimes with an extended variant, e.g. egrep or sed. Here, I have put together the best top 10 regex cheat sheets for you to download, This regex list was written by Catherine on her dev.to profile where she explains regex expressions in Java-script she has compiled with her resources at the bottom of here article. Pros: Great spot to read someone else's experience in regex and to gather new resources. Cons: More of an article than an.

Regular expression syntax cheatsheet - JavaScript MD

Java Regex Cheat Sheet (taken from: http://stackoverflow

Java Cheat Sheet - Cheat Dumper

Java Regular Expression Cheat Sheet Pd

Regex Cheat Sheet A collection of useful regular expression techniques and examples for the JavaScript developer. 514 words. By Jeff Delaney. Created May 18, 2020 Last Updated May 18, 2020. Slack #javascript #regex. Regular Expressions are notoriously difficult to learn - they have a very compact syntax that ends up looking like gibberish. However, they can be extremely powerful when it comes. Java - Regular Expressions, Java provides the java.util.regex package for pattern matching with regular expressions. Java regular expressions are very similar to the Perl programming lang Apache Nifi Expression Language Cheat Sheet. Apache Nifi Expression language allows dynmic values in functional fields. This is a short reference to find useful functions and examples. For a full reference see the offical documentation . Download a PDF version Regex Cheat Sheet CHARACTER CLASSES [abc]Matches PATTERN a or b, or c. [^abc] Negation, matches everything except a, b, or c. [a-c]Range, matches a or b, or c. [a-c[f-h]] Union, matches a, b, c, f, g, h. [a-c&&[b-c]] Intersection, matches b or c. [a-c&&[^b-c]] Subtraction, matches a. USEFUL JAVA CLASSES & METHODS A pattern is a compiler representation of a regular expression For more information, see Regular Expression Options. [aeiou] Matches any single character included in the specified set of characters. [^aeiou] Matches any single character not in the specified set of characters. [0-9a-fA-F] Use of a hyphen (-) allows specification of contiguous character ranges. \p {name

Regular Expression Test Page for Java. Share: Expression to test. Regular expression: Options: Force canonical equivalence (CANON_EQ) Case insensitive (CASE_INSENSITIVE) Allow comments in regex (COMMENTS) Dot matches line terminator (DOTALL) Treat as a sequence of literal characters (LITERAL) ^ and $ match EOL (MULTILINE) Unicode case matching (UNICODE_CASE) Only consider '\n' as line. As mentioned, \. is the regular expression but to construct a String for this expression in Java you will need \\. because \ is used within Java strings for things like \n, \t etc. so \\ is needed for a literal \ within a String. Also, note that String.matches requires the regexp to match the entire String. If you want to do a substring search you will need to use Matcher.fin Java Regex to check Min/Max Length of Input Text. The following regular expression ensures that text is between 1 and 10 characters long, and additionally limits the text to the uppercase letters A-Z. You can modify the regular expression to allow any minimum or maximum text length or allow characters other than A-Z. package net.javaguides.corejava.regex; import java.util.ArrayList; import.

Java 8 – cheat sheet – Laurent Hinoul

Regex Expression Cheat Sheet Pdf; Regex Cheat Sheet Pdf; Notepad++ Regex Cheatsheet; The tables below are a reference to basic regex. While reading the rest of the site, when in doubt, you can always come back and look here. (It you want a bookmark, here's a direct link to the regex reference tables). I encourage you to print the tables so you. Regular expression tester with syntax highlighting, PHP / PCRE & JS Support, contextual help, cheat sheet, reference, and searchable community patterns. RegExr is an online tool to learn, build, & test Regular Expressions (RegEx / RegExp). Untitled Pattern. Save (--) New; by. The regex below is borrowed from chapter 4 of Jan Goyvaert's excellent book, Regular Expressions Cookbook. I'm in tune with Jan's reasoning that what you really want is an expression that works with 999 addresses out of a thousand, an expression that doesn't require a lot of maintenance, for instance by forcing you to add new top-level domains (dot something) every time the powers in charge.

regex - Exclude symbol from regular expression PHP - Stack

Cucumber Regular Expressions Cheat Sheet Pattern Notes Match Examples. one of anything (except a newline) a B 3.* any character (except a newline) 0 or more times a AbCD words with punctuation! 123-456 an empty string.+ at least one of anything (except a newline) all of the above except the empty string.{2} exactly two of any character aa Ab!n 2 This lesson explains how to use the java.util.regex API for pattern matching with regular expressions. Although the syntax accepted by this package is similar to the Perl programming language, knowledge of Perl is not a prerequisite. This lesson starts with the basics, and gradually builds to cover more advanced techniques JavaScript Cheat Sheet The Language of the Web. ##### TABLE OF CONTENTS JavaScript Basics 3 Variables in JavaScript 3 The Next Level: Arrays 4 Operators 5 Functions 6 JavaScript Loop 7 If - Else Statements 8 Strings 8 Regular Expression Syntax 9 Numbers and Math 11 Dealing with Dates in JavaScript 13 DOM Mode 14 Working with the User Browser 17 JavaScript Events 19 2 of 24. JAVASCRIPT BASICS.

#Wrap-up. I hope you liked my little but - hopefully - helpful cheat sheet. Of course, this list isn't exhaustive at all. There are a lot more commands but I'm sure you will find them in the MongoDB documentation.. If you feel like I forgot a critical command in this list, please send me a tweet and I will make sure to fix it.. Check out our free courses on MongoDB University if you are not. A regex can be used to ensure that data received is valid from a security point of view if the input data have a simple format JAVA: Method (PDF version is used in this cheat sheet). Article about Bypassing SSRF Protection. Articles about SSRF attacks: Part 1, part 2 and part 3. Article about IMDSv2. Tools and code used for schemas¶ Mermaid Online Editor and Mermaid documentation.

This JavaScript Cheat Sheet summarizes the all useful elements on a single page. It marks the code example for every element included. Contains different sections for loops, variables, arrays, strings, events, numbers, dates, functions etc. It also encapsulates the Regular Expressions, Errors, JSON, Promises Regular Expressions Cheat Sheet in Node.js. A detailed story to learn, write and execute regular expressions easily . Petros Koulianos ☠. Follow. Apr 7, 2020 · 6 min read. Photo by Gábor Molnár on Unsplash. 1. Introduction. Regular expressions are a topic that confuses and struggles a lot of developers due to its crypt syntax. A regular expression is a string that contains a. It is also known as regexp. When user learns regular expression then there might be a need for quick look of those concepts which he didn't use often. So to provide that facility, a regex cheat sheet is created which contains the different classes, Characters, modifiers etc. which are used in regular expression Java. It's identical. From Java, you can call Groovy code in the following ways. Note that you need to have the groovy-all.jar in your classpath. Cross-compilation Use groovyc, the <groovyc/> ant task or your IDE integration to compile your groovy code together with your Java code. This enables you to use your Groovy code as if it was written. Regular expressions in Go: introduction, cheat sheet and plenty of code examples

Regular expressions. Developing regular expressions can be complicated, and is well beyond the scope of this cheat sheet. There are lots of resources on the internet about how to write regular expressions, including this site and the OWASP Validation Regex Repository ASP.NET Core Basic Security Settings Cheat Sheet; ASP.NET Core Form Tag Helpers Cheat Sheet; ASP.NET Core JSON API Cheat Sheet.NET Security Cheat Sheet (OWASP).NET Framework 4 and Extensions Poster [PDF] Visual Studio 2017 Poster.NET CLI Cheat Sheet.NET Standard DateTime Format Strings [PDF].NET Regular Expression Cheat Sheet Java's matcher.matches() (also Pattern.matches( regex, input )) matches the entire string. It has no direct equivalent in Python. The same result can be achieved by using re.match( regex, input ) with a regex that ends with $. Java's matcher.find() and Python's re.search( regex, input ) match any part of the string. Java's matcher.lookingAt. Groovy cheat sheet. Welcome to the Groovy cheat sheet! This is a condensed reference for Groovy syntax and other information that you might regularly want to look up. 1. Core types and operators. Groovy comes with a selection of the basic types you'd expect, such as strings and numbers anmelden. Aus SELFHTML-Wiki. Wechseln zu: Navigation. , Suche. Ein Regulärer Ausdruck (kurz Regex oder Regexp von regular expression) stellt in der Programmierung ein verallgemeinertes Suchmuster für Zeichenketten dar. Damit können Sie beispielsweise Variableninhalte dahingehend prüfen, ob sie bestimmten Mustern genügen

WebsiteSetup.org - Beginner's Javascript Cheat Sheet 8. Convert strings to lowercase toUpperCase() Convert strings to uppercase valueOf() Returns the primitive value (that has no properties or methods) of a string object Regular Expressions Pattern Modifiers e — Evaluate replacement i — Perform case-insensitive matching g — Perform global matching m — Perform multiple line. Java Regular Expression Tutorial - Java Regex Groups « Previous; Next » We can group multiple characters as a unit by parentheses. For example, (ab). Each group in a regular expression has a group number, which starts at 1. Method groupCount() from Matcher class returns the number of groups in the pattern associated with the Matcher instance. The group 0 refers to the entire regular. Regular expressions don't have to include regex metacharacters. For example, you can create a segment for all data from India with the following filter definition: Country matches regex India Regular expressions are greedy by nature: if you don't tell them not to, they match what you specify plus any adjacent characters. For example, site matches mysite, yoursite, theirsite, parasite--any. OS Command Injection Defense Cheat Sheet Introduction. Command injection (or OS Command Injection) is a type of injection where software that constructs a system command using externally influenced input does not correctly neutralize the input from special elements that can modify the initially intended command

JavaScript regular expressions cheatsheet and example

Developing regular expressions can be complicated, and is well beyond the scope of this cheat sheet. There are lots of resources on the internet about how to write regular expressions, including this site and the OWASP Validation Regex Repository. In summary, input validation should: Be applied to all input data, at minimum. Define the allowed set of characters to be accepted. Defines a. Pentaho Data Integration Cheat Sheet. How to start. Some steps used in transformations. Often used job entries. Regular expressions. Tips and tricks . References. Pentaho Data Integration Cheat Sheet. This is a short guideline for Kettle: Pentaho Data Integration (PDI) - mainly with Spoon - the development environment. First read general information about Pentaho platform and PDI. Since. Summary: This page is a printf formatting cheat sheet. I originally created this cheat sheet for my own purposes, and then thought I would share it here. A great thing about the printf formatting syntax is that the format specifiers you can use are very similar — if not identical — between different languages, including C, C++, Java, Perl, PHP, Ruby, Scala, and others Regular Expressions / Regex Cheat Sheet. Character. Meaning. Example. *. Match zero, one or more of the previous. Ah* matches Ahhhhh or A . ? Match zero or one of the previous

30 Cheatsheets & Infographics For Software Developers

Regular expressions are not as difficult as regex haters make them seem. While regex are intimidating, this cheat sheet will help you overcome that You can consult the regex cheat sheet at the bottom of the page to verify which regex tokens you can use to achieve your desired outcome. RegexPal - This tool also allows you to input your regex expression along with a test string to see if you receive the results you expect. RegexPal also provides you with a larger list of regex examples as well as a regex cheat sheet for reference. If you're.

Regex Cheat Sheet Python, PHP, Perl, JavaScript, Rub

Java regex is the official Java regular expression API. The term Java regex is an abbreviation of Java regular expression.The Java regex API is located in the java.util.regex package which has been part of standard Java (JSE) since Java 1.4. This Java regex tutorial will explain how to use this API to match regular expressions against text Thanks to the handy replaceAll() method in the String class, we can easily do string substitution with regular expressions. However, sometimes the expressions can be confusing, for example, \s and \s+. In this short tutorial, we'll have a look at the difference between the two regular expressions through examples. 2. The Difference Between \s. Most of these cheat sheets are a work in progress. Feel free to contact me with suggestions, or comments. ColdFusion Cheat Sheet. CFSCRIPT ColdFusion Cheat Sheet. DateFormat ColdFusion Cheat Sheet. jQuery UI Icons. Java 1.5 Cheat Sheet. PostgreSQL. Regular Expressions / Regex Cheat Sheet PHP PCRE Cheat Sheet Functions preg_match(pattern, subject[, submatches]) preg_match_all(pattern, subject[, submatches]) preg_replace(pattern, replacement, subject) preg_replace_callback(pattern, callback, subject) preg_grep(pattern, array) preg_split(pattern, subject) Base Character Classes \w Any word character (a-z 0-9 _) \W Any non word character \s Whitespace (space, tab CRLF.

Java Programming Cheatsheet - Princeton Universit

In this post we will look at Java Regular Expression(Regex) Interview questions. Examples are provided with explanations. Q: What are Java Regex ? A:Java provides the java.util.regex package for pattern matching with regular expressions. It is widely used to define the constraint on strings such as password and email validation Just looking at a regular expressions cheat sheet won't help; you first have to understand where to use regex and why you want to use it. Get your own regex library. Get an Expressions app and improve Regex performance. Best utilities in one pack, give it a go! Try free We'll provide you with a beginner's regex tutorial, a handy regex cheat sheet, and tell you about some apps to help you along. A quick cheat sheet for using Notepad++ to find and replace arbitrary text in Notepad++. In all examples, use select Find and Replace (Ctrl + H) to replace all the matches with the desired string or (no string). And also ensure the 'Regular expression' radio button is set. 1. Removing arbitrary whitespaces and tabs PANIOV: JAVA - Java 8 Streams cheat sheet. R In Front Of Regex - Article Blog. Sintesi dettagliata Il museo nella storia - Docsity. C and C++ Cheat Sheet | Javascript cheat sheet, Regular expression وبینار «what's new on Scopus» - کتابخانه مرکزی دانشگاه علوم پزشکی تهران . Pin de NOURAH FALAH en Java | Programacion. 暴风英雄传_大旗门.

Regex Cheat Sheet OverAPI

Java Regex. The Java Regex or Regular Expression is an API 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. After learning Java regex tutorial, you will be able to test your regular expressions by the Java Regex Tester Tool Java Cheat Sheet : Java Glossary. This document is a quick summary of the Java language syntax. It is not complete. It just contains the things you may be likely to forget. I have most of these common patterns built-in as SlickEdit macros so I don't have to remember the patterns. I just click a custom icon for the pattern I want Java RegEx Case Insensitive example shows how to make Java regex case insensitive. The example also shows how to make Java regular expression case insensitive using (?i) modifier as well as Pattern class. How to make Java RegEx case insensitive? By default Java regular expressions are case sensitive. Consider below given example The java.util.regex API (the package which we need to import while dealing with Regex) has two main classes: 1) java.util.regex.Pattern - Used for defining patterns 2) java.util.regex.Matcher - Used for performing match operations on text using patterns. java.util.regex.Pattern class: 1) Pattern.matches() We have already seen the usage of this method in the above example where we performed. value.contains(/regex/) value.contains(string) Determines whether value contains the regular expression regex or the string string. A Boolean (true or false). regex = regular expression to search value = coffee and tea and chai and mate value.contains(and) TRUE value.replace(t, u) If t is a regular expression, use /(t)

Java Cheat Sheet by yuyu - Download free from CheatographyJavaScript Cheat Sheet by DaveChild - Download free from

17 Regex Cheat Sheets - Cheatography

JavaScript Cheat Sheet — Numbers, Strings, and Regex. Post author By John Au-Yeung; Post date January 2, 2021; No Comments on JavaScript Cheat Sheet — Numbers, Strings, and Regex; Spread the love. JavaScript is one of the most popular programming languages for web programming. In this article, we'll look at the basic syntax of modern JavaScript. Numbers. The toFixed method lets us round. Note regular expression implementations. Note Ranges are inclusive. These patterns are intended for reference purposes and have not been extensively tested. Note Please use with caution and test thoroughly before use. Control character White space Not white space Digit Not digit Word Not word Hexadecimal character hh Octal character xxx Character Classes \c \s \S \d \D \w \W \xhh \Oxxx Upper.

JavaScript Regular Expression Cheatsheet - Debugge

Regex cookbook — Top 10 Most wanted regex. Jonny Fox. Mar 20, 2019 · 4 min read. The most commonly used (and most wanted) regexes. After some time I thought about publishing this article ( see. SQL Cheat Sheet Mosh Hamedani Code with Mosh (codewithmosh.com) 1st Editio

Regular Expression Javascript Cheat Shee

Java regex to match word with nonboundaries - contain word example. Suppose, you want to match java such that it should be able to match words like javap or myjava or myjavaprogram i.e. java word can lie anywhere in the data string. It could be start of word with additional characters in end, or could be in end of word with additional characters in start as well as in. This cheat sheet is intended to be a quick reminder for the main concepts involved in using the command line p. Quick Ref.ME. Edit page Facebook Twitter. Grep cheatsheet. This cheat sheet is intended to be a quick reminder for the main concepts involved in using the command line program grep and assumes you already understand its usage. #Getting started #Usage. Search standard output (i.e. a. Clojure 1.10 Cheat Sheet (v49) Download PDF version / Source repo. Many thanks to Steve Tayon for creating it and Andy Fingerhut for ongoing maintenance. Documentation. clojure.repl/ doc find-doc apropos dir source pst javadoc (foo.bar/ is namespace for later syms) Primitives Numbers. Literals: Long: 7, hex 0xff, oct 017, base 2 2r1011, base 36 36rCRAZY BigInt: 7N Ratio: -22/7 Double: 2.78 -1.

22 Essential AJAX and JavaScript Cheat Sheets - blueblotsCheat sheets – Laurent HinoulVBScript Cheat Sheet | OverAPI

Additional Resources. Now that you've completed this lesson on regular expressions, you'll probably find that your main references will be the API documentation for the following classes: Pattern, Matcher, and PatternSyntaxException. For a more precise description of the behavior of regular expression constructs, we recommend reading the book. A regular expression is a pattern that the regular expression engine attempts to match in input text. A pattern consists of one or more character literals, operators, or constructs. For a brief introduction, see .NET Regular Expressions. Each section in this quick reference lists a particular category of characters, operators, and constructs that you can use to define regular expressions. We. Introduction Java version 1.4 introduces the java.util.regex package. If they don't work, use Wassup to check out the version of Java you are using. You may be inadvertently using an old one. Perl-like Regex expressions are compiled into a Pattern (parsed into an internal state machine format, not byte code). You don't use a constructor to create a Pattern; you use the static method Pattern When attempting to build a logical or operation using regular expressions, we have a few approaches to follow. Fortunately the grouping and alternation facilities provided by the regex engine are very capable, but when all else fails we can just perform a second match using a separate regular expression - supported by the tool or native language of your choice