Save & Share

Flavor

  • PCRE2 (PHP)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java
  • .NET 7.0 (C#)
  • Rust
  • PCRE (Legacy)
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests
Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression
Processing...

Test String

Code Generator

Generated Code

import java.util.regex.Matcher; import java.util.regex.Pattern; public class Example { public static void main(String[] args) { final String regex = "^(?P<series>[(][^_-]+?[)])?[\\s]*(?P<author>(?! [-]).*?)([\\s]+?-[\\s]*)(?P<title>[^\\(]*?)(?P<titletail>[\\s]*?)((?P<comments>[\\(](?:[\\s]*(((?P<published>[12][\\d]{3,3})\\s*)((?=([,\\)]))))?)?((?P<prepublisher>[\\w]*?[,-]?)([,]?[\\s]*((?P<publisher>[-|~'&%$#\"!\\w\\s]*(([a-zA-Z]+)[-|~'&%$#\"!\\w\\s]*))(?!(([\\d-]{11}-?([x]|[\\d])[\\s]*[\\)])))))?(?P<isbn>([,]?[\\s]*(?P<isbntag>(?i)ISBN[-]?1(?:(?P<is10>0)|3)?[:\\s])?\\s*(?(isbntag)(?(is10)((?=[\\d-]{11}-[\\d|x][\\s]*[\\)])(?P<isbn10>\\d{1,5}[ -]\\d{1,7}[ -]\\d{1,6}[ -](?:\\d|x)))|((?:(?=[\\d-]{17}[\\s]*[\\)])(?P<isbn13>97(?:8|9)[ -]\\d{1,5}[ -]\\d{1,7}[ -]\\d{1,6}[ -]\\d))))|(?:(?=(([\\d-]{11}-([\\d]|[x]))[\\s]*[\\)]))(?P<ISBN10>\\d{1,5}([ -])\\d{1,7}[ -]\\d{1,6}[ -](?:\\d|x))|(?:(?=[\\d-]{17}[\\s]*[\\)])(?P<ISBN13>97(?:8|9)[ -]\\d{1,5}[ -]\\d{1,7}[ -]\\d{1,6}[ -]\\d)))))?)(?=([\\s]*[,\\)])))?(?P<tooManyCommasOrOnlyDigits>.*)[\\s]*[\\)]))*?[.](?P<extension>[[:alpha:]]+)$"; final String string = "(Graduate Texts in Mathematics 228) Fred Diamond, Jerry Shurman (auth.) - A First Course in Modular Forms - Springer-Verlag New York (2005).pdf\n" + "Antonio Martinez-Abe--jón - Correct Antidifferentiation_ The Change Of Variable Well Done - World Scientific (2020).pdf\n" + "(Lecture Notes in Mathematics) Peter G. Casazza, Thaddeus J. Shura, J Baker, O. Slotterbeck, R. Aron - Tsirelsons Space-Springer (1989).djvu\n\n" + "Antonio Martinez-Abejón - Correct Antidifferentiation_ The Change Of Variable Well Done - World Scientific (2020).pdf\n\n" + "Junji Ito - The Enigma of Amigara Fault.pdf\n" + "Junji Ito - The Enigma of Amigara Fault(.pdf\n" + "Junji Ito - The Enigma of Amigara Fault().pdf\n\n" + "[series ] author - this is it (1234, 345-801-028-x).epub\n" + "[series ] author - this is it (1234, 345-801-028-8).epub\n\n\n" + "[series ] author - this is it (1234, 345-801-028-x).epub\n" + "[series ] author - this is it (1234, 345-801-028-8).epub\n\n\n" + " author, et6wl - this fsis it (123h4 , ISBN-13: 978-801-028-060-7 ).epub\n\n" + "[serie0'0'&%'&%$&%$#\"$\"!s ] author, au-thor !\"#$%&'=~| - this!\"\"#$%&'=~|¥¥¥¥¥¥--[[[[]]]:: is it (1234, publish , 345-801-028-x ).epub\n\n" + "[serie ] author, author - this is it (1234, publish ,ISBN-10: 345-801-028-x ).epub\n" + "[serie ] author, author - this is it (1234, publish ,ISBN-10: 345-801-028-x ).epub\n\n" + "[series ] author - this is it (1234, 345-801-028-8).epub\n" + "[series ] author - this is it (1234, 345-801-028-x).epub\n\n" + "[series ] author - this it (1234,ddddd 345-801-028-8).epub\n" + "[series ] author - this is it (1234, 345-801-028-8).epub\n\n" + "[series ] author - this is it (9234, 345-801-028-x).epub\n\n" + "[series ]author - this is it (1234, 978-801-028-060-7).epub\n" + "[series ]author - this is it (123, 1234erw978-8888801-028-060-7).epub\n" + "[series ]author - this is it (978-801-028-060-7).epub\n" + "[series ]author - this is it (78-801-0260-7).epub\n" + "[series ]author - not enough dashes (78-80-150260-7).epub\n" + "[series ]author - this is it (12343-p978-801-0260-7).epub\n\n" + "[series ]author - this is it (g123,978-801-028-060-7).epub\n\n" + "[series ]author - this is it (1234-lk-jkj978-801-028-060-7).epub\n" + "[series ]author - this is it (1234,lkjkj978-801-028-060-7).epub\n" + "[series ]author - this is it (123,4lkjkj,978-801-028-060-7).epub\n\n" + "[series ]author - this is it (1234,jhkh987'&%'%$#$%&ljh,lkjnkjnlkjhljh 5545t , 978-801-028-060-7).epub\n" + "(,1234)\n\n" + "[series ]author - this is it (,ISBN-13: 978-801-028-060-7).epub\n" + "[series ]author - this is it (1234,ISBN-10: 978-801-006-0).epub\n" + "[series ]author - this is it (1234,ISBN-13: 978-801-028-060-7).epub\n" + "[series ]author - this is it (,ISBN-10: 978-801-006-x).epub\n" + "[series ]author - this is it (ISBN-10: 978-801-006-x).epub\n\n" + "(Graduate Texts in Mathematics) Daniel W. Stroock - Essentials of Integration Theory for Analysis-Springer (2020).pdf\n" + "(Graduate Texts in Mathematics 3) Helmut H. Schaefer (auth.) - Topological Vector Spaces-Springer New York (1971).pdf\n" + "(Pure and Applied Mathematics) Lawrence Narici, Edward Beckenstein - Topological Vector Spaces-Chapman and Hall_CRC (2011).djvu\n" + "(Lecture Notes in Mathematics) L. Bernstein - The Jacobi-Perron Algorithm Its Theory and Application-Springer (1971).djvu\n" + "(Memoirs AMS 85) Donald W. Solomon - Denjoy Integration in Abstract Spaces-Amer Mathematical Society (1969).djvu\n" + "(Springer Series in Statistics) Shelby J. Haberman (auth.) - Advanced Statistics_ Description of Populations-Springer-Verlag New York (1996).pdf\n" + "(Graduate Studies in Mathematics, Vol.4) Russell A. Gordon - The Integrals of Lebesgue, Denjoy, Perron, and Henstock-American Mathematical Society (1994).pdf\n" + "(Springer Series in Statistics) Per Kragh Andersen, Ørnulf Borgan, Richard D. Gill, Niels Keiding (auth.) - Statistical Models Based on Counting Processes-Springer-Verlag New York (1993).pdf\n" + "(Mathematical Surveys and Monographs 007-2) A. H. Clifford - The algebraic theory of semigroups. Vol.2-American Mathematical Society (1967).djvu\n" + "(History of Mathematics) Christopher Hollings - Mathematics Across the Iron Curtain_ A History of the Algebraic Theory of Semigroups-American Mathematical Society (2014).pdf\n" + "(Undergraduate Lecture Notes in Physics) Bruce Cameron Reed - The History and Science of the Manhattan Project, 2nd ed.-Springer (2019).pdf\n" + "Bruce Cameron Reed - The Physics of the Manhattan Project-Springer (2014).pdf\n\n" + "Junji Ito - The Enigma of Amigara Fault.pdf\n\n" + "(Lecture Notes in Mathematics) Peter G Casazza Thaddeus J Shura J Baker O Slotterbeck R Aron - Tsirelsons Space-Springer (1989).djvu\n\n" + "IKEI SEKAI.cbz\n" + "Yami no Koe (notitle).cbr\n" + "uzumaki-3vols notitle.zip\n\n" + "(Lecture Notes in Mathematics) Peter G Casazza Thaddeus J Shura J Baker O Slotterbeck R Aron - Tsirelsons Space-Springer (1989).djvu\n\n\n" + "Mark F. Sanders, John L. Bowman - Genetic Analysis_ An Integrated Approach-Pearson Education (2014).pdf\n" + "Rey Chow, Paul Bowman - The Rey Chow Reader-Columbia University Press (2010).epub\n" + "([sic], 7) Sebastian Budgen, Stathis Kouvelakis, Slavoj Zizek, David Fernbach - Lenin Reloaded_ Toward a Politics of Truth-Duke University Press Books (2007).pdf\n" + "Paul Bowman, Richard Stamp - The Truth of Zizek-Bloomsbury Academic (2007).pdf\n" + "John Stewart Bowman - Columbia chronologies of Asian history and culture-Columbia University Press (2000).pdf\n" + "Constance Bowman Reid - Slacks and Calluses_ Our Summer in a Bomber Factory-Smithsonian Books (2004).epub\n" + "Shawn Gascoyne-Bowman - Criminal Crafts_ From D.I.Y. to F.B.I. Outlaw Projects for Scoundrels, Cheats, and Armchair Detectives-Andrews McMeel Publishing (2012).epub\n" + "Maurice Isserman, John S. Bowman - Vietnam War (America at War) (2003).pdf\n" + "Sharon L. Bowman - Training From the Back of the Room!_ 65 Ways to Step Aside and Let Them Learn (2008).pdf\n" + "Gary Bowman - Essential Quantum Mechanics-Oxford University Press, USA (2008).pdf\n" + "(Statistics, textbooks and monographs 103) K. O. Bowman, L. R. Shenton - Continued fractions in statistical applications-M. Dekker (1989).djvu\n" + "Frank Bowman - Introduction to Bessel Functions-Dover Publications (2010).djvu\n" + "E. Hille, R. Phillips - Functional Analysis and Semi-Groups.pdf\n" + "Einar Hille - Functional Analysis And Semi-Groups-Dutt Press (2007).djvu\n" + "Prof. Dr. Heinz-Otto Peitgen, Prof. Dr. Peter H. Richter (auth.) - The Beauty of Fractals_ Images of Complex Dynamical Systems-Springer-Verlag Berlin Heidelberg (1986).pdf\n" + "09notitle.pdf\n" + "9502219 (1).pdf\n" + "020707798 dddd-- -.pdf\n" + "(Universitext_ Tracts in Mathematics) Lennart Carleson, Theodore W. Gamelin (auth.) - Complex Dynamics-Springer-Verlag New York (1993).pdf\n" + "Charles Jordan - Calculus of Finite Differences (AMS Chelsea Publishing)-American Mathematical Society (1950).pdf\n" + "Robert Ghrist - Calculus BLUE Multivariable Vol 4_ Fields (2018).pdf\n" + "Robert Ghrist - Elementary Applied Topology-CreateSpace Independent Publishing Platform (2014).pdf\n" + "(Series on Advances in Mathematics for Applied Sciences) Bellomo N. (ed.) - Lecture Notes on Mathematical Theory of the Boltzmann Equation-World Scientific (1995).djvu\n" + "9502219.pdf\n" + "2b597b0c2f8fe191982391986140cbb462ea.pdf\n" + "rm8370.pdf\n" + "(Cambridge Library Collection - Mathematics) George Boole - A Treatise on the Calculus of Finite Differences-Cambridge University Press (2009).pdf\n" + "(Mathematics in Science and Engineering 19) J. Aczpl (Eds.) - Lectures on Functional Equations their and Applications-Elsevier, Academic Press (1966).pdf\n" + "ᾠA. A. Bolibruch, Yu. S. Osipov, Ya. G. Sinai, V. I. Arnold, A. A. Bolibruch, A. M. Vershik, Yu. I. Manin, Yu. S. Osipov, Ya.G. Sinai, V.M. Tikhomirov, L.D. Faddeev, V. B. Philippov (eds.) - Mathemati.pdf\n" + "(London Mathematical Society Student Texts) Jonathan R. Partington - Linear Operators and Linear Systems_ An Analytical Approach to Control Theory-Cambridge University Press (2004).pdf\n" + "Ib Henning Madsen, Jørgen Tornehave - From calculus to cohomology_ de Rham cohomology and characteristic classes-Cambridge University Press (1997).pdf\n" + "(Universitext) Dr. Shiing-shen Chern (auth.) - Complex Manifolds without Potential Theory_ with an appendix on the geometry of characterist\n" + "Jean Meeus - Astronomical Algorithms-Willmann-Bell (1998).pdf\n" + "Stern - Anyons and the qauantum Hall Effect A Pedagogical reviewarovas_Stern_2007.pdf\n" + "William C. Reynolds, Piero Colonna - Thermodynamics_ Fundamentals and engineering applications-Cambridge University Press (2018).pdf\n" + "Barry B. Luokkala - Exploring Science Through Science Fiction-Not Avail (2014).epub\n" + "(BTEC 2016) Jennifer Stafford-Brown, Simon Rea, Tim Eldridge - BTEC National Level 3 Sport and Exercise Science 4th Edition-Hodder Education (2016).epub\n" + "John Dirk Walecka - Introduction to Electricity and Magnetism-World Scientific Publishing Company (2018).pdf\n" + "William R. Gibbs - Computation In Modern Physics-World Scientific Publishing Co Pte Ltd (2006).pdf\n" + "I. T Todorov - Analytic properties of Feynman diagrams in quantum field theory -Pergamon (1971).djvu\n" + "Duncan Carlsmith - Particle Physics-Pearson (2013).pdf\n" + "HSP - Mississippi Science, Grade 1 - Interactive Student Edition-Houghton Mifflin Harcourt (HMH) (2007).pdf\n" + "(1) James S. Walker - Pearson Physics. 1-Pearson Education (2013).pdf\n" + "Duncan Carlsmith - Particle Physics-Pearson (2013) copy.pdf\n" + "Abraham Seiden - Particle Physics A Comprehensive Introduction-Pearson Addison Wesley (2005).pdf\n" + "Brian Arnold_ Steve Woolley_ Penny Johnson - Edexcel International GCSE (9-1) Physics Student Book-Pearson Education Limited (2017).pdf\n" + "James E. Ackroyd, Mark Anderson, Carmen Berg, Brian E. Martin - Pearson Physics – Student Edition (2009).pdf\n" + "HSP - Mississippi Science, Grade 2 - Interactive (Write-in) Student Edition-Houghton Mifflin Harcourt (HMH) (2007).pdf\n" + "Free HIgh School Science Texts.pdf\n" + "Firk - Introduction to Groups, Invariants and Particles.pdf\n" + "Paul W. Zitzewitz, T. G. Elliott, Haase, Kathleen A. Harper, Herzog, Nelson, Friedrich Schiller, Zorn - Physics. Principles and Problems [textbook]-McGraw-Hill_Glencoe (2004).pdf\n" + "J. P. Elliott, P. G. Dawber (auth.) - Symmetry in Physics_ Volume 1_ Principles and Simple Applications-Macmillan Education UK (1979).pdf\n" + "(Lecture Notes in Physics 732) Franco Strocchi (auth.) - Symmetry Breaking-Springer-Verlag Berlin Heidelberg (2008).pdf\n" + "Robinson, Matthew B - Symmetry and the standard model_ Mathematics and particle physics-Springer (2011).pdf\n" + "J. P. Elliott, P. G. Dawber (auth.) - Symmetry in Physics_ Further Applications-Macmillan Education UK (1979).pdf\n" + "10.1038@s41567-019-0748-5.pdf\n" + "(Mathematics and Its Applications 290) Geoffrey M. Dixon (auth.) - Division Algebras_ Octonions, Quaternions, Complex Numbers and the Algebraic Design of Physics-Springer US (1994).pdf\n" + "(NATO ASI Series 352) Murray Gell-Mann (auth.), Harvey B. Newman, Thomas Ypsilantis (eds.) - History of Original Ideas and Basic Discoveries in Particle Physics-Springer US (1996).pdf\n" + "Mann, Robert - An Introduction to Particle Physics and the Standard Model-CRC Press (2009).pdf\n" + "Mark Thomson - Modern Particle Physics Student Solutions Manual-Cambridge University Press (2013).pdf\n" + "B.H. Bransden, C.J. Joachain - Physics of Atoms and Molecules-Longman Publishing Group (1982).djvu\n" + "Bransden B., Joachain C. - Quantum Mechanics (2000, Pearson).djvu\n" + "Bransden B H. - Atomic Collision Theory-W A Benjamin Inc (1970).djvu\n" + "Fermi E. - Nuclear Physics-University Of Chicago Press (1974).djvu\n" + "(Midway reprints) Jay Orear_ Enrico Fermi_ Arthur H Rosenfeld_ Robert A Schluter - Nuclear physics _ a course given by Enrico Fermi at the University of Chicago-University of Chicago Press (1974).djvu\n" + "Dr. John M. Marzluff, Mr. Tony Angell - In the Company of Crows and Ravens (2007).pdf\n" + "Misha Shifman - Felix berezin_ life and death of the mastermind of supermathematics-Wspc (2007).pdf\n" + "M Shifman (ed.) - Physics in a Mad World. Houtermans, Golfand-World Scientific (2015).epub\n" + "Anthony Duncan - The Conceptual Framework of Quantum Field Theory (2012, Oxford University Press, USA).pdf\n" + "(Cambridge monographs on mathematical physics) Erick J Weinberg - Classical solutions in quantum field theory _ solitons and instantons in high energy physics-Cambridge University Press (2012).pdf\n" + "Luc Steels_ Katrien Beuls - Case Studies in Fluid Construction Grammar_ The Verb Phrase-John Benjamins Publishing Company (2019).pdf\n" + "(Palgrave Studies In Literature, Science And Medicine) Emily Alder - Weird Fiction And Science At The Fin De Siècle-Palgrave Macmillan (2020).pdf\n" + "Anthony Duncan_ Michel Janssen - Constructing Quantum Mechanics_ Volume 1_ The Scaffold_ 1900-1923-Oxford University Press, USA (2019).pdf\n" + "(The Frontiers Collection) Dean Rickles - A Brief History of String Theory_ From Dual Models to M-Theory-Springer (2014).pdf\n" + "0711_PRL99.pdf\n" + "[Frontiers in Physics] Graham Ross - Grand Unified Theories (1984, Benjamin-Cummings Pub Co) (1).djvu\n" + "0911.0695.pdf\n" + "Robert Botet, Marek Poszajczak, M. Ploszajczak - Universal fluctuations_ the phenomenology of hadronic matter-World Scientific Publishing Company (2002).pdf\n" + "Book_Hadronic_Matter.pdf\n" + "11519879.pdf\n" + "0210054.pdf\n" + "Standard_Model_Flowchart.pdf\n" + "The Algebra of Grand Unified Theories John Baez and John Huerta.pdf\n" + "The Algebra of Grand Unified Theories John Huerta.pdf\n\n"; final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); final Matcher matcher = pattern.matcher(string); while (matcher.find()) { System.out.println("Full match: " + matcher.group(0)); for (int i = 1; i <= matcher.groupCount(); i++) { System.out.println("Group " + i + ": " + matcher.group(i)); } } } }

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html