Regular Expressions 101

Save & Share

  • Regex Version: ver. 2
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

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
  • 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

/
/
gm

Test String

Code Generator

Generated Code

$re = '/OutgoingBunches.Num.\(([0-9]*)\).exceeds.reliable.threa?shold.\(([0-9]*)\).but.this.would.overflow.the.reliable.buffer!.{0,30}Channel:.([ \.\w\[\]:\/]*),.Role/m'; $str = '# ([ \\.\\w\\[\\]:\\/]*) needed to avoid spanning across multiple copies of the message [2024.12.03-16.24.04:835][773]LogNet: NotifyAcceptingConnection accepted from: 197.91.86.165:58948 [2024.12.03-16.24.08:533][885]LogServer: Display: Server startup time elapsed and saving/level loading is done, auto-pause is allowed to proceed from now on (if enabled in server settings). WorldTimeSeconds = 30.07 [2024.12.03-16.24.08:575][886]LogNetPackageMap: Warning: FNetGUIDCache::SupportsObject: MaterialInstanceDynamic /Game/FactoryGame/Map/GameLevel01/Persistent_Level.Persistent_Level:PersistentLevel.Build_Loose_C_2147332400.ContainerSignMesh_Loose.MaterialInstanceDynamic_2147464945 NOT Supported. [2024.12.03-16.24.15:015][ 81]LogNetPartialBunch: Warning: OutgoingBunches.Num (270) exceeds reliable threashold (8) but this would overflow the reliable buffer! Consider sending less stuff. Channel: [UActorChannel] Actor: FGConveyorChainSubsystem /Game/FactoryGame/Map/GameLevel01/Persistent_Level.Persistent_Level:PersistentLevel.ConveyorChainSubsystem, Role: 3, RemoteRole: 1 [UChannel] ChIndex: 539, Closing: 0 [UNetConnection] RemoteAddr: 197.91.86.165:62243, Name: IpConnection_2147455887, Driver: GameNetDriver FGDSIpNetDriver_2147482083, IsServer: YES, PC: BP_PlayerController_C_2147455555, Owner: BP_PlayerController_C_2147455555, UniqueId: Steam:2 (ForeignId=[Type=6 Handle=1 RepData=[61AC350301001001]) [2024.12.03-16.24.15:018][ 81]LogNetPartialBunch: Warning: SendBunch: Reliable partial bunch overflows reliable buffer! [UActorChannel] Actor: FGConveyorChainSubsystem /Game/FactoryGame/Map/GameLevel01/Persistent_Level.Persistent_Level:PersistentLevel.ConveyorChainSubsystem, Role: 3, RemoteRole: 1 [UChannel] ChIndex: 539, Closing: 0 [UNetConnection] RemoteAddr: 197.91.86.165:62243, Name: IpConnection_2147455887, Driver: GameNetDriver FGDSIpNetDriver_2147482083, IsServer: YES, PC: BP_PlayerController_C_2147455555, Owner: BP_PlayerController_C_2147455555, UniqueId: Steam:2 (ForeignId=[Type=6 Handle=1 RepData=[61AC350301001001]) [2024.12.03-16.24.15:019][ 81]LogNetPartialBunch: Warning: Num OutgoingBunches: 270. NumOutRec: 0 [2024.12.03-16.24.15:019][ 81]LogNet: UNetConnection::SendCloseReason: [2024.12.03-16.24.15:019][ 81]LogNet: - Result=ReliableBufferOverflow, ErrorContext="ReliableBufferOverflow" [2024.12.03-16.24.15:019][ 81]LogNet: UNetConnection::Close: [UNetConnection] RemoteAddr: 197.91.86.165:62243, Name: IpConnection_2147455887, Driver: GameNetDriver FGDSIpNetDriver_2147482083, IsServer: YES, PC: BP_PlayerController_C_2147455555, Owner: BP_PlayerController_C_2147455555, UniqueId: Steam:2 (ForeignId=[Type=6 Handle=1 RepData=[61AC350301001001]), Channels: 615, Time: 2024.12.03-16.24.15 [2024.12.03-16.24.15:019][ 81]LogNet: UNetConnection::SendCloseReason: [2024.12.03-16.24.15:020][ 81]LogNet: - Result=ReliableBufferOverflow, ErrorContext="ReliableBufferOverflow" [2024.12.03-16.24.15:020][ 81]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 197.91.86.165:62243, Name: IpConnection_2147455887, Driver: GameNetDriver FGDSIpNetDriver_2147482083, IsServer: YES, PC: BP_PlayerController_C_2147455555, Owner: BP_PlayerController_C_2147455555, UniqueId: Steam:2 (ForeignId=[Type=6 Handle=1 RepData=[61AC350301001001]) [2024.12.03-16.24.15:033][ 82]LogFactory: Warning: Put down failed because we where never equipped. [2024.12.03-16.24.15:033][ 82]LogFactory: Warning: Put down failed because we where never equipped. [2024.12.03-16.24.15:033][ 82]LogAkAudio: Warning: UAkGameplayStatics::StopActor: Could not retrieve audio device.'; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); // Print the entire match result var_dump($matches);

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 PHP, please visit: http://php.net/manual/en/ref.pcre.php