Regular Expressions 101

Save & Share

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

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
  • Match everything enclosed
    (?:...)
  • Capture everything enclosed
    (...)
  • 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

/
/
mg

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 = "(?<timestamp>\\w+\\s+\\d+,\\s+\\d+\\s+\\d+:\\d+:\\d+\\.\\d+)[^\\]\\n]*\\]\\s+(?<loglevel>\\w+) - (?<full_message>(?:(?:MDE\\: (?<media>[^\\:]+): (?<media_message>(?:Direct Play is (?<direct_play>\\w+))?(?:no direct play video profile exists for (?<media_codecs>.*))?.*))?(?:\\[?(?<status_source>\\w+)((\\]|: ))?)?(?:Adding (?<session_number>\\d) sessions\\.)?(?:authenticated user \\d+ as (?<user>.*))?(?:Found session GUID of (?<session_guid>[^\\s]+))?(?:Using local file path instead of URL\\: (?<file_path>.*))?(?:Session (?<playback_session_guid>[^\\s]+) \\((?<playback_session_number>[^\\)]+)\\) is (?<placyback_session_status>\\w+))?(?:using profile (?<transcode_profile>.*))?(?:.*\\/transcode\\/session\\/(?<transcode_session_guid>[^\\/]+))?(?:It took (?<time_taken>[\\d\\.]+) sec to (?<action_taken>.*))?)?.*)"; final String string = "Nov 05, 2016 15:37:29.438 [0x7f781a3ff700] DEBUG - MDE: Finding Dory (2016): Direct Play is disabled\n" + "Nov 05, 2016 15:37:29.438 [0x7f781a3ff700] DEBUG - MDE: Finding Dory (2016): no direct play video profile exists for http/mkv/h264\n" + "Nov 05, 2016 15:37:29.438 [0x7f781a3ff700] DEBUG - MDE: Finding Dory (2016): no direct play video profile exists for http/mkv/h264/aac\n" + "Nov 05, 2016 15:37:29.439 [0x7f781a3ff700] DEBUG - MDE: Finding Dory (2016): selected media 0 / 15024\n" + "Nov 05, 2016 15:37:01.307 [0x7f77fe7f7700] DEBUG - [Now] Adding 0 sessions.\n" + "Nov 05, 2016 15:37:01.307 [0x7f77fe7f7700] DEBUG - It took 0.0 sec to serialize a list with 0 elements.\n" + "Nov 05, 2016 15:37:01.307 [0x7f78193fd700] DEBUG - Completed: [127.0.0.1:44216] 200 GET /status/sessions (6 live) 0ms 186 bytes\n" + "Nov 05, 2016 15:37:29.348 [0x7f78193fd700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.\n" + "Nov 05, 2016 15:37:29.348 [0x7f78193fd700] DEBUG - Auth: authenticated user 1 as tyzbit\n" + "Nov 05, 2016 15:37:29.348 [0x7f78193fd700] DEBUG - Auth: Came in with a super-token, authorization succeeded.\n" + "Nov 05, 2016 15:37:29.348 [0x7f77fa7f9700] DEBUG - Request: [192.168.1.50:52168 (Subnet)] POST /playQueues?type=video&uri=library%3A%2F%2F51222608-c41d-4f80-8fef-f1751b0a507c%2Fitem%2F%252Flibrary%252Fmetadata%252F12166&shuffle=0&repeat=0&includeChapters=1 (6 live) TLS GZIP Signed-in Token (tyzbit)\n" + "Nov 05, 2016 15:37:29.349 [0x7f77fa7f9700] DEBUG - PlayQueue: 0 generated IDs compressed down to a 2 byte blob.\n" + "Nov 05, 2016 15:37:29.355 [0x7f77fa7f9700] DEBUG - PlayQueue: Start index: 0 End index: 0 Count: 1\n" + "Nov 05, 2016 15:37:29.355 [0x7f77fa7f9700] DEBUG - PlayQueue: 1 generated IDs compressed down to a 24 byte blob.\n" + "Nov 05, 2016 15:37:29.359 [0x7f77fa7f9700] DEBUG - PlayQueue: Added 1 items in 0.0 sec.\n" + "Nov 05, 2016 15:37:29.366 [0x7f77fa7f9700] DEBUG - We're going to try to auto-select an audio stream for account 1.\n" + "Nov 05, 2016 15:37:29.366 [0x7f77fa7f9700] DEBUG - Selecting best audio stream for part ID 17824 (autoselect: 0 language: en)\n" + "Nov 05, 2016 15:37:29.366 [0x7f77fa7f9700] DEBUG - We're going to try to auto-select a subtitle.\n" + "Nov 05, 2016 15:37:29.366 [0x7f77fa7f9700] DEBUG - Audio Stream: 104553, Subtitle Stream: -1\n" + "Nov 05, 2016 15:37:29.366 [0x7f77fa7f9700] DEBUG - It took 0.0 sec to serialize a list with 1 elements.\n" + "Nov 05, 2016 15:37:29.368 [0x7f78193fd700] DEBUG - Completed: [192.168.1.50:52168] 200 POST /playQueues?type=video&uri=library%3A%2F%2F51222608-c41d-4f80-8fef-f1751b0a507c%2Fitem%2F%252Flibrary%252Fmetadata%252F12166&shuffle=0&repeat=0&includeChapters=1 (6 live) TLS GZIP 19ms 3064 bytes\n" + "Nov 05, 2016 15:37:29.426 [0x7f7819bfe700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.\n" + "Nov 05, 2016 15:37:29.426 [0x7f7819bfe700] DEBUG - Auth: authenticated user 1 as tyzbit\n" + "Nov 05, 2016 15:37:29.426 [0x7f7819bfe700] DEBUG - Auth: Came in with a super-token, authorization succeeded.\n" + "Nov 05, 2016 15:37:29.427 [0x7f781a3ff700] DEBUG - Request: [192.168.1.50:52168 (Subnet)] GET /video/:/transcode/universal/decision?hasMDE=1&path=http%3A%2F%2F127.0.0.1%3A32400%2Flibrary%2Fmetadata%2F12166&mediaIndex=0&partIndex=0&protocol=http&fastSeek=1&directPlay=0&directStream=1&subtitleSize=100&audioBoost=100&location=lan&session=nzxzt409ramwp2hmx4hb2zkt9&offset=0&subtitles=burn&copyts=1&Accept-Language=en (6 live) TLS GZIP Signed-in Token (tyzbit)\n" + "Nov 05, 2016 15:37:29.427 [0x7f781a3ff700] DEBUG - Found session GUID of nzxzt409ramwp2hmx4hb2zkt9 in session start.\n" + "Nov 05, 2016 15:37:29.427 [0x7f781a3ff700] DEBUG - TranscodeUniversalRequest: using profile Web\n" + "Nov 05, 2016 15:37:29.428 [0x7f781a3ff700] DEBUG - Downloading document http://127.0.0.1:32400/library/metadata/12166?X-Plex-Token=xxxxxxxxxxxxxxxxxxxx\n" + "Nov 05, 2016 15:37:29.428 [0x7f781a3ff700] DEBUG - HTTP requesting GET http://127.0.0.1:32400/library/metadata/12166?X-Plex-Token=xxxxxxxxxxxxxxxxxxxx\n" + "Nov 05, 2016 15:37:29.429 [0x7f7819bfe700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.\n" + "Nov 05, 2016 15:37:29.429 [0x7f7819bfe700] DEBUG - Auth: authenticated user 1 as tyzbit\n" + "Nov 05, 2016 15:37:29.429 [0x7f7819bfe700] DEBUG - Auth: Came in with a super-token, authorization succeeded.\n" + "Nov 05, 2016 15:37:29.429 [0x7f78097ff700] DEBUG - Request: [127.0.0.1:44219 (Loopback)] GET /library/metadata/12166 (7 live) GZIP Signed-in Token (tyzbit)\n" + "Nov 05, 2016 15:37:29.435 [0x7f78097ff700] DEBUG - We're going to try to auto-select an audio stream for account 1.\n" + "Nov 05, 2016 15:37:29.435 [0x7f78097ff700] DEBUG - Selecting best audio stream for part ID 17824 (autoselect: 0 language: en)\n" + "Nov 05, 2016 15:37:29.435 [0x7f78097ff700] DEBUG - We're going to try to auto-select a subtitle.\n" + "Nov 05, 2016 15:37:29.435 [0x7f78097ff700] DEBUG - Audio Stream: 104553, Subtitle Stream: -1\n" + "Nov 05, 2016 15:37:29.436 [0x7f78097ff700] DEBUG - It took 0.0 sec to serialize a list with 1 elements.\n" + "Nov 05, 2016 15:37:29.436 [0x7f7819bfe700] DEBUG - Completed: [127.0.0.1:44219] 200 GET /library/metadata/12166 (7 live) GZIP 7ms 2890 bytes\n" + "Nov 05, 2016 15:37:29.436 [0x7f781a3ff700] DEBUG - HTTP 200 response from GET http://127.0.0.1:32400/library/metadata/12166?X-Plex-Token=xxxxxxxxxxxxxxxxxxxx\n" + "Nov 05, 2016 15:37:29.438 [0x7f781a3ff700] DEBUG - MDE: analyzing media item 15024\n" + "Nov 05, 2016 15:37:29.439 [0x7f781a3ff700] DEBUG - Streaming Resource: Added session 0x7f78182494a0:bymiyvmkxrwwc3xqyzyjbgldi\n" + "Nov 05, 2016 15:37:29.439 [0x7f781a3ff700] DEBUG - Streaming Resource: Reached Decision id=12166 codes=(General=1001,Direct play not available; Conversion OK. Direct Play=3000,App cannot direct play this item. Direct play is disabled. Transcode=1001,Direct play not available; Conversion OK.) media=(id=15024 part=(id=17824 decision=transcode container=mkv protocol=http streams=(Video=(id=104552 decision=copy width=1920 height=1080) Audio=(id=104553 decision=copy channels=6 rate=48000))))\n" + "Nov 05, 2016 15:37:29.440 [0x7f781a3ff700] DEBUG - It took 0.0 sec to serialize a list with 1 elements.\n" + "Nov 05, 2016 15:37:29.441 [0x7f7819bfe700] DEBUG - Completed: [192.168.1.50:52168] 200 GET /video/:/transcode/universal/decision?hasMDE=1&path=http%3A%2F%2F127.0.0.1%3A32400%2Flibrary%2Fmetadata%2F12166&mediaIndex=0&partIndex=0&protocol=http&fastSeek=1&directPlay=0&directStream=1&subtitleSize=100&audioBoost=100&location=lan&session=nzxzt409ramwp2hmx4hb2zkt9&offset=0&subtitles=burn&copyts=1&Accept-Language=en (7 live) TLS GZIP 14ms 2867 bytes (pipelined: 2)\n" + "Nov 05, 2016 15:37:29.462 [0x7f7819bfe700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.\n" + "Nov 05, 2016 15:37:29.462 [0x7f7819bfe700] DEBUG - Auth: authenticated user 1 as tyzbit\n" + "Nov 05, 2016 15:37:29.462 [0x7f7819bfe700] DEBUG - Auth: Came in with a super-token, authorization succeeded.\n" + "Nov 05, 2016 15:37:29.463 [0x7f77fa7f9700] DEBUG - Request: [192.168.1.50:52169 (Subnet)] GET /video/:/transcode/universal/start?hasMDE=1&path=http%3A%2F%2F127.0.0.1%3A32400%2Flibrary%2Fmetadata%2F12166&mediaIndex=0&partIndex=0&protocol=http&fastSeek=1&directPlay=0&directStream=1&subtitleSize=100&audioBoost=100&location=lan&session=nzxzt409ramwp2hmx4hb2zkt9&offset=0&subtitles=burn&copyts=1&Accept-Language=en (8 live) TLS Signed-in Token (tyzbit)\n" + "Nov 05, 2016 15:37:29.463 [0x7f77fa7f9700] DEBUG - Found session GUID of nzxzt409ramwp2hmx4hb2zkt9 in session start.\n" + "Nov 05, 2016 15:37:29.463 [0x7f77fa7f9700] DEBUG - TranscodeUniversalRequest: using profile Web\n" + "Nov 05, 2016 15:37:29.463 [0x7f77fa7f9700] DEBUG - Downloading document http://127.0.0.1:32400/library/metadata/12166?X-Plex-Token=xxxxxxxxxxxxxxxxxxxx&checkFiles=1\n" + "Nov 05, 2016 15:37:29.463 [0x7f77fa7f9700] DEBUG - HTTP requesting GET http://127.0.0.1:32400/library/metadata/12166?X-Plex-Token=xxxxxxxxxxxxxxxxxxxx&checkFiles=1\n" + "Nov 05, 2016 15:37:29.464 [0x7f7819bfe700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.\n" + "Nov 05, 2016 15:37:29.465 [0x7f7819bfe700] DEBUG - Auth: authenticated user 1 as tyzbit\n" + "Nov 05, 2016 15:37:29.465 [0x7f7819bfe700] DEBUG - Auth: Came in with a super-token, authorization succeeded.\n" + "Nov 05, 2016 15:37:29.465 [0x7f781a3ff700] DEBUG - Request: [127.0.0.1:44220 (Loopback)] GET /library/metadata/12166 (8 live) GZIP Signed-in Token (tyzbit)\n" + "Nov 05, 2016 15:37:29.491 [0x7f781a3ff700] DEBUG - We're going to try to auto-select an audio stream for account 1.\n" + "Nov 05, 2016 15:37:29.491 [0x7f781a3ff700] DEBUG - Selecting best audio stream for part ID 17824 (autoselect: 0 language: en)\n" + "Nov 05, 2016 15:37:29.492 [0x7f781a3ff700] DEBUG - We're going to try to auto-select a subtitle.\n" + "Nov 05, 2016 15:37:29.492 [0x7f781a3ff700] DEBUG - Audio Stream: 104553, Subtitle Stream: -1\n" + "Nov 05, 2016 15:37:29.492 [0x7f781a3ff700] DEBUG - It took 0.0 sec to serialize a list with 1 elements.\n" + "Nov 05, 2016 15:37:29.493 [0x7f7819bfe700] DEBUG - Completed: [127.0.0.1:44220] 200 GET /library/metadata/12166 (8 live) GZIP 27ms 2905 bytes\n" + "Nov 05, 2016 15:37:29.493 [0x7f77fa7f9700] DEBUG - HTTP 200 response from GET http://127.0.0.1:32400/library/metadata/12166?X-Plex-Token=xxxxxxxxxxxxxxxxxxxx&checkFiles=1\n" + "Nov 05, 2016 15:37:29.494 [0x7f77fa7f9700] DEBUG - Cleaning directory for session nzxzt409ramwp2hmx4hb2zkt9 ()\n" + "Nov 05, 2016 15:37:29.494 [0x7f77fa7f9700] DEBUG - Starting a transcode session nzxzt409ramwp2hmx4hb2zkt9 at offset -1.0 (state=3)\n" + "Nov 05, 2016 15:37:29.496 [0x7f77fa7f9700] DEBUG - [Universal] Using local file path instead of URL: /media/movies/Finding Dory.mkv\n" + "Nov 05, 2016 15:37:29.497 [0x7f77fa7f9700] DEBUG - Job running: FFMPEG_EXTERNAL_LIBS='/var/lib/plexmediaserver/Library/Application\\ Support/Plex\\ Media\\ Server/Codecs/5a2d9a2-1127-linux-ubuntu-x86_64/' XDG_CACHE_HOME='/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/' XDG_DATA_HOME='/usr/lib/plexmediaserver/Resources/' X_PLEX_TOKEN='xxxxxxxxxxxxxxxxxxxx' '/usr/lib/plexmediaserver/Plex Transcoder' '-codec:0' 'h264' '-noaccurate_seek' '-i' '/media/movies/Finding Dory.mkv' '-map' '0:0' '-codec:0' 'copy' '-map' '0:1' '-metadata:s:1' 'language=eng' '-codec:1' 'copy' '-copypriorss:1' '0' '-f' 'matroska' '-avoid_negative_ts' 'disabled' '-map_metadata' '-1' '-map_chapters' '-1' '-' '-start_at_zero' '-copyts' '-y' '-nostats' '-loglevel' 'quiet' '-loglevel_plex' 'error' '-progressurl' 'http://127.0.0.1:32400/video/:/transcode/session/nzxzt409ramwp2hmx4hb2zkt9/progress'\n" + "Nov 05, 2016 15:37:29.549 [0x7f78193fd700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.\n" + "Nov 05, 2016 15:37:29.549 [0x7f78193fd700] DEBUG - Auth: Came in with the master token, authorization succeeded.\n" + "Nov 05, 2016 15:37:29.550 [0x7f781a3ff700] DEBUG - Request: [127.0.0.1:44221 (Loopback)] PUT /video/:/transcode/session/nzxzt409ramwp2hmx4hb2zkt9/progress?index=0&id=0&codec=h264&type=video (8 live) Signed-in Token (tyzbit)\n" + "Nov 05, 2016 15:37:29.550 [0x7f78193fd700] DEBUG - Completed: [127.0.0.1:44221] 206 PUT /video/:/transcode/session/nzxzt409ramwp2hmx4hb2zkt9/progress?index=0&id=0&codec=h264&type=video (8 live) 0ms 190 bytes\n" + "Nov 05, 2016 15:37:29.551 [0x7f7819bfe700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.\n" + "Nov 05, 2016 15:37:29.551 [0x7f7819bfe700] DEBUG - Auth: Came in with the master token, authorization succeeded.\n" + "Nov 05, 2016 15:37:29.551 [0x7f78097ff700] DEBUG - Request: [127.0.0.1:44222 (Loopback)] PUT /video/:/transcode/session/nzxzt409ramwp2hmx4hb2zkt9/progress?index=1&id=0&codec=aac&type=audio (9 live) Signed-in Token (tyzbit)\n" + "Nov 05, 2016 15:37:29.551 [0x7f7819bfe700] DEBUG - Completed: [127.0.0.1:44222] 206 PUT /video/:/transcode/session/nzxzt409ramwp2hmx4hb2zkt9/progress?index=1&id=0&codec=aac&type=audio (8 live) 0ms 190 bytes\n" + "Nov 05, 2016 15:37:29.588 [0x7f781a3ff700] DEBUG - [Transcoder] Average FPS ~ 24 fps, Frame rate ~ 24 fps.\n" + "Nov 05, 2016 15:37:29.589 [0x7f77fa7f9700] DEBUG - [FFMPEG] Duration: 5823\n" + "Nov 05, 2016 15:37:29.589 [0x7f77fa7f9700] DEBUG - Read line, and done: 1\n" + "Nov 05, 2016 15:37:29.589 [0x7f77fa7f9700] DEBUG - Started session successfully: nzxzt409ramwp2hmx4hb2zkt9\n" + "Nov 05, 2016 15:37:29.590 [0x7f7817fff700] DEBUG - [TranscodeOutputStream] Input processing thread started at offset 0 for -1 bytes.\n" + "Nov 05, 2016 15:37:29.590 [0x7f7804ff5700] DEBUG - Started universal transcode output thread\n" + "Nov 05, 2016 15:37:29.591 [0x7f7819bfe700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.\n" + "Nov 05, 2016 15:37:29.591 [0x7f7819bfe700] DEBUG - Auth: Came in with the master token, authorization succeeded.\n" + "Nov 05, 2016 15:37:29.591 [0x7f781a3ff700] DEBUG - Request: [127.0.0.1:44224 (Loopback)] PUT /video/:/transcode/session/nzxzt409ramwp2hmx4hb2zkt9/progress?width=1920&height=1080 (8 live) Signed-in Token (tyzbit)\n" + "Nov 05, 2016 15:37:29.591 [0x7f781a3ff700] DEBUG - It took 0.0 sec to serialize a list with 0 elements.\n" + "Nov 05, 2016 15:37:29.591 [0x7f7819bfe700] DEBUG - Completed: [127.0.0.1:44224] 206 PUT /video/:/transcode/session/nzxzt409ramwp2hmx4hb2zkt9/progress?width=1920&height=1080 (8 live) 0ms 289 bytes\n" + "Nov 05, 2016 15:37:30.093 [0x7f7819bfe700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.\n" + "Nov 05, 2016 15:37:30.093 [0x7f7819bfe700] DEBUG - Auth: Came in with the master token, authorization succeeded.\n" + "Nov 05, 2016 15:37:30.093 [0x7f77fa7f9700] DEBUG - Request: [127.0.0.1:44225 (Loopback)] PUT /video/:/transcode/session/nzxzt409ramwp2hmx4hb2zkt9/progress?progress=1.6&size=38161989&speed=182.1&remaining=31 (9 live) Signed-in Token (tyzbit)\n" + "Nov 05, 2016 15:37:30.094 [0x7f77fa7f9700] DEBUG - It took 0.0 sec to serialize a list with 0 elements.\n" + "Nov 05, 2016 15:37:30.094 [0x7f78193fd700] DEBUG - Completed: [127.0.0.1:44225] 206 PUT /video/:/transcode/session/nzxzt409ramwp2hmx4hb2zkt9/progress?progress=1.6&size=38161989&speed=182.1&remaining=31 (9 live) 0ms 289 bytes\n" + "Nov 05, 2016 15:37:30.325 [0x7f78193fd700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.\n" + "Nov 05, 2016 15:37:30.325 [0x7f78193fd700] DEBUG - Auth: authenticated user 1 as tyzbit\n" + "Nov 05, 2016 15:37:30.325 [0x7f78193fd700] DEBUG - Auth: Came in with a super-token, authorization succeeded.\n" + "Nov 05, 2016 15:37:30.325 [0x7f78097ff700] DEBUG - Request: [192.168.1.50:52168 (Subnet)] GET /:/timeline?hasMDE=1&ratingKey=12166&key=%2Flibrary%2Fmetadata%2F12166&state=playing&playQueueItemID=43940&time=0&duration=5823672 (9 live) TLS GZIP Signed-in Token (tyzbit)\n" + "Nov 05, 2016 15:37:30.326 [0x7f78097ff700] DEBUG - Client [bymiyvmkxrwwc3xqyzyjbgldi] reporting timeline state playing, progress of 0/5823672ms for guid=, ratingKey=12166 url=, key=/library/metadata/12166, containerKey=, metadataId=12166\n" + "Nov 05, 2016 15:37:30.358 [0x7f78097ff700] DEBUG - We're going to try to auto-select an audio stream for account 1.\n" + "Nov 05, 2016 15:37:30.358 [0x7f78097ff700] DEBUG - Selecting best audio stream for part ID 17824 (autoselect: 0 language: en)\n" + "Nov 05, 2016 15:37:30.359 [0x7f78097ff700] DEBUG - We're going to try to auto-select a subtitle.\n" + "Nov 05, 2016 15:37:30.359 [0x7f78097ff700] DEBUG - Audio Stream: 104553, Subtitle Stream: -1\n" + "Nov 05, 2016 15:37:30.360 [0x7f78097ff700] DEBUG - [Now] User is tyzbit (ID: 1)\n" + "Nov 05, 2016 15:37:30.361 [0x7f78097ff700] DEBUG - [Now] Device is Chrome (Plex Web (Chrome)).\n" + "Nov 05, 2016 15:37:30.361 [0x7f78097ff700] DEBUG - [Now] Profile is Web\n" + "Nov 05, 2016 15:37:30.361 [0x7f78097ff700] DEBUG - [Now] Updated play state for /library/metadata/12166.\n" + "Nov 05, 2016 15:37:30.361 [0x7f78097ff700] DEBUG - Statistics: (tqycrf1uzs07qef9zjj5j0pb9) Reporting active playback in state 0 of type 1 (scrobble: 0) for account 1\n" + "Nov 05, 2016 15:37:30.362 [0x7f78097ff700] DEBUG - It took 0.0 sec to serialize a list with 0 elements.\n" + "Nov 05, 2016 15:37:30.363 [0x7f78193fd700] DEBUG - Completed: [192.168.1.50:52168] 200 GET /:/timeline?hasMDE=1&ratingKey=12166&key=%2Flibrary%2Fmetadata%2F12166&state=playing&playQueueItemID=43940&time=0&duration=5823672 (8 live) TLS GZIP 37ms 433 bytes (pipelined: 3)\n" + "Nov 05, 2016 15:37:30.368 [0x7f7819bfe700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.\n" + "Nov 05, 2016 15:37:30.368 [0x7f7819bfe700] DEBUG - Auth: authenticated user 1 as tyzbit\n" + "Nov 05, 2016 15:37:30.368 [0x7f7819bfe700] DEBUG - Auth: Came in with a super-token, authorization succeeded.\n" + "Nov 05, 2016 15:37:30.369 [0x7f781a3ff700] DEBUG - Request: [192.168.1.50:52168 (Subnet)] GET /status/sessions (8 live) TLS GZIP Signed-in Token (tyzbit)\n" + "Nov 05, 2016 15:37:30.369 [0x7f781a3ff700] DEBUG - [Now] Adding 1 sessions.\n" + "Nov 05, 2016 15:37:30.369 [0x7f781a3ff700] DEBUG - It took 0.0 sec to serialize a list with 1 elements.\n" + "Nov 05, 2016 15:37:30.371 [0x7f7819bfe700] DEBUG - Completed: [192.168.1.50:52168] 200 GET /status/sessions (7 live) TLS GZIP 2ms 3361 bytes (pipelined: 4)\n" + "Nov 05, 2016 15:37:30.423 [0x7f78193fd700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.\n" + "Nov 05, 2016 15:37:30.423 [0x7f78193fd700] DEBUG - Auth: authenticated user 1 as tyzbit\n" + "Nov 05, 2016 15:37:30.423 [0x7f78193fd700] DEBUG - Auth: Came in with a super-token, authorization succeeded.\n" + "Nov 05, 2016 15:37:30.423 [0x7f78097ff700] DEBUG - Request: [192.168.1.50:52168 (Subnet)] GET /status/sessions (7 live) TLS GZIP Signed-in Token (tyzbit)\n" + "Nov 05, 2016 15:37:30.423 [0x7f78097ff700] DEBUG - [Now] Adding 1 sessions.\n" + "Nov 05, 2016 15:37:30.423 [0x7f78097ff700] DEBUG - It took 0.0 sec to serialize a list with 1 elements.\n" + "Nov 05, 2016 15:37:30.425 [0x7f78193fd700] DEBUG - Completed: [192.168.1.50:52168] 200 GET /status/sessions (7 live) TLS GZIP 1ms 3361 bytes (pipelined: 5)\n" + "Nov 05, 2016 15:37:30.593 [0x7f78193fd700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.\n" + "Nov 05, 2016 15:37:30.593 [0x7f78193fd700] DEBUG - Auth: Came in with the master token, authorization succeeded.\n" + "Nov 05, 2016 15:37:30.593 [0x7f781a3ff700] DEBUG - Request: [127.0.0.1:44226 (Loopback)] PUT /video/:/transcode/session/nzxzt409ramwp2hmx4hb2zkt9/progress?progress=3.3&size=80792393&speed=201.8&remaining=29 (8 live) Signed-in Token (tyzbit)\n" + "Nov 05, 2016 15:37:30.594 [0x7f781a3ff700] DEBUG - It took 0.0 sec to serialize a list with 0 elements.\n" + "Nov 05, 2016 15:37:30.594 [0x7f78193fd700] DEBUG - Completed: [127.0.0.1:44226] 206 PUT /video/:/transcode/session/nzxzt409ramwp2hmx4hb2zkt9/progress?progress=3.3&size=80792393&speed=201.8&remaining=29 (8 live) 0ms 289 bytes\n" + "Nov 05, 2016 15:37:31.095 [0x7f78193fd700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.\n" + "Nov 05, 2016 15:37:31.095 [0x7f78193fd700] DEBUG - Auth: Came in with the master token, authorization succeeded.\n" + "Nov 05, 2016 15:37:31.096 [0x7f78097ff700] DEBUG - Request: [127.0.0.1:44227 (Loopback)] PUT /video/:/transcode/session/nzxzt409ramwp2hmx4hb2zkt9/progress?progress=5.1&size=125076388&speed=206.2&remaining=26 (9 live) Signed-in Token (tyzbit)\n" + "Nov 05, 2016 15:37:31.096 [0x7f78097ff700] DEBUG - It took 0.0 sec to serialize a list with 0 elements.\n" + "Nov 05, 2016 15:37:31.096 [0x7f78193fd700] DEBUG - Completed: [127.0.0.1:44227] 206 PUT /video/:/transcode/session/nzxzt409ramwp2hmx4hb2zkt9/progress?progress=5.1&size=125076388&speed=206.2&remaining=26 (9 live) 0ms 289 bytes\n" + "Nov 05, 2016 15:37:31.595 [0x7f78193fd700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.\n" + "Nov 05, 2016 15:37:31.595 [0x7f78193fd700] DEBUG - Auth: Came in with the master token, authorization succeeded.\n" + "Nov 05, 2016 15:37:31.596 [0x7f77fa7f9700] DEBUG - Request: [127.0.0.1:44228 (Loopback)] PUT /video/:/transcode/session/nzxzt409ramwp2hmx4hb2zkt9/progress?progress=6.9&size=170289095&speed=214.3&remaining=25 (10 live) Signed-in Token (tyzbit)\n" + "Nov 05, 2016 15:37:31.596 [0x7f77fa7f9700] DEBUG - Session nzxzt409ramwp2hmx4hb2zkt9 (1) is throttling\n" + "Nov 05, 2016 15:37:31.596 [0x7f77fa7f9700] DEBUG - It took 0.0 sec to serialize a list with 0 elements.\n" + "Nov 05, 2016 15:37:31.596 [0x7f78193fd700] DEBUG - Completed: [127.0.0.1:44228] 206 PUT /video/:/transcode/session/nzxzt409ramwp2hmx4hb2zkt9/progress?progress=6.9&size=170289095&speed=214.3&remaining=25 (9 live) 0ms 305 bytes\n" + "Nov 05, 2016 15:37:31.597 [0x7f781a3ff700] DEBUG - [Transcoder] Throttle - Going into sloth mode.\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