Regular Expressions 101

Save & Share

  • Regex Version: ver. 4
  • 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

// include the latest version of the regex crate in your Cargo.toml extern crate regex; use regex::Regex; fn main() { let regex = Regex::new(r"(?m)^(?>[\t\v]+(?<GECKScript>[]!#$%&()*+.\/0-9:;<=>A-Z[a-z{|}^-]+))+").unwrap(); let string = "Scn NVDLC01VaultCodeHolderScript ; Script that handles variables, and events, for Elijah's confrontation at the Vault. ; - Jorge ; Vault Level Variables: Short bPlayerSafe Short bPlayerBlocks Short bVaultOpen Short bTreasureFound Short bSecurityAltInfo Short bChristineHelp Short bDeanHelp Int iTurretsDown Int iSecurityState Int iElevatorState Int iMaintenanceState ; Elijah Variables: Short bElijahContacted Short bElijahTaunted Short bElijahInVault Short bElijahPaths Short bElijahTurnsSecurityOn Short bElijahEntersVault Short bElijahArrivesVault Short bElijahOpensVault Short bElijahFights Short bElijahDead Short bElijahTrapped Short bElijahTrapsPlayer Short bElijahTeamsWithPlayer short bPlayerTrapped Int iElijahState Int iChristineStrikes Float fAngle ; Operational Variables: Int iCount Float fTimer ; >>>>---------------- Begin Code; ; >>>>---------------- Begin GameMode If (bTreasureFound == 1) If (bVaultOpen == 1) ; If Players have opened the Vault previously. If (bElijahContacted == 1) ; If Players have contacted Elijah - start sequence. If (iElijahState == 0) ; If First Stage of Endgame. If (bElijahInVault == 0) ; If Elijah not yet teleported to Vault. NVDLC01ElijahREF.Disable; NVDLC01ElijahREF.MoveTo NVDLC01VaultStartMarkerREF; SetStage NVDLC01MQ03 48; Set bElijahInVault to 1; Return; Else NVDLC01ElijahREF.Enable; ; Enable Elijah once he's been moved to the Vault. Set iElijahState to 1; ; Ready Elijah for the next stage of events/AI behaviors. Set bElijahPaths to 1; ; Set variable to be checked by Elijah's AI package. Return; Endif Elseif (iElijahState == 1) If (iCount == 0) NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijaIntroPathTravel; ; Add AI Package to Elijah to path to Vault. NVDLC01ElijahREF.SetGhost 1; ; Make Elijah impervious to combat - this resets, and scene jumps to fight, if he's attacked. Set iCount to 1; Return; Elseif (iCount >= 1) If (NVDLC01ElijahREF.GetDetected Player == 1) ;ShowWarning \"Elijah Detected You!\" If (bPlayerSafe != 1) If (iCount == 1) NVDLC01ElijahREF.RemoveScriptPackage NVDLC01VaultElijaIntroPathTravel ; Set iCount to 2; Return; Elseif (iCount == 2) If (bElijahEntersVault == 0) NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahFightOutTravel; ; Add AI Package to Elijah to path to Fight Outside spot. Else NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahFightOut2Travel; ; Add AI Package to Elijah to path to Fight Outside spot, but make him run. Endif VaultPeskyFieldREF.MoveTo VaultPeskyFieldOnMarker; ; In this case, we immediately close off the retraversal path doors, since Elijah will inevitably trigger the Vault Security against players VaultPeskyFieldBlocker2REF.Enable; ; while trapping them inside the Vault Chamber area. This leads, always, to the \"Fight Elijah\" fall-through state. VaultPeskyFieldBlocker3REF.Enable; ; These doors, will open again once Elijah dies. VaultPeskyField03bREF.SetPos Z 10406.0000; Set iElijahState to 2; ; Ready Elijah for the next stage of events/AI behaviors (2 = Fight Outside). Set bElijahFights to 1; Set iCount to 0; ; Reset operational integer. Return; Endif Else ; If Elijah detects players, and they are in a safe zone (opposite side of Vault entrance), VaultSecurityExitDoorsMarker.Enable; ; then we trigger the Vault's defenses, and move the script to the same state that happens VaultEntryDoor02REF.SetOpenState 0; ; when Elijah has been trapped without noticing players (but we skip the scene where he gets attacked by security). VaultEntryDoor01REF.SetOpenState 0; VaultSecurityMeasuresMarker.Enable; VaultFinalSpeaker01REF.SetDestroyed 0; VaultFinalSpeaker02REF.SetDestroyed 0; VaultFinalSpeaker01REF.Activate Player 1; VaultFinalSpeaker02REF.Activate Player 1; VaultFinalSpeaker01REF.SetDestroyed 1; VaultFinalSpeaker02REF.SetDestroyed 1; NVDLC01ElijahREF.PlayIdle PipboyManipulate; Set iElijahState to 3; Set iSecurityState to 1; Set iCount to 0; Set fTimer to 0; Return; Endif Else ; If Elijah does not detect players, let him continue to the Vault door. If (bElijahArrivesVault == 1) ; If Elijah gets to the front of the Door. NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahOpenVaultDoorTravel; ; (TEMP) Add AI Package to Elijah to path to Vault door marker. Set iElijahState to 3; ; Ready Elijah for stage of events/AI in which he can become trapped. ;Set bElijahOpensVault to 1; ; Set variable to be checked by Elijah's AI package (to avoid AddScriptPackage calls). Set iCount to 0; Return; Else ; If Elijah has not yet arrived at the door to the Vault. If (bElijahTaunted == 1 || iSecurityState == 1) ; If Players have consciously provoked Elijah to fight during the intercom scene (that is, he's not going to fight inside right away). If (NVDLC01ElijahREF.GetDistance VaultElijaVaultFightOutMarkerREF <= 320) ; If Elijah nears the Fight Outside Marker NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahFightOutTravel; ; (TEMP) Add AI Package to Elijah to path to Fight Outside spot. Set iElijahState to 2; ; Ready Elijah for the next stage of events/AI behaviors (2 = Fight Outside). Set bElijahFights to 1; ; Set variable to be checked by Elijah's AI package (to avoid AddScriptPackage calls). Set iCount to 0; ; Reset operational integer. Return; Else If (bPlayerBlocks == 1) ; If players run up the main exit stairs, and Elijah's far from its fighting marker (as checked above, he's not going into chamber). NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahFightOutTravel; ; (TEMP) Add AI Package to Elijah to path to Fight Outside spot. Set iElijahState to 2; ; Ready Elijah for the next stage of events/AI behaviors (2 = Fight Outside). Set bElijahFights to 1; ; Set variable to be checked by Elijah's AI package (to avoid AddScriptPackage calls). Set iCount to 0; ; Reset operational integer. Return; Endif Endif Else ; If Elijah was tricked during the intercom conversation; If (bPlayerBlocks == 1) ; If Player enters the quick-exit area (stairs to entry pod). If (bElijahEntersVault == 0) ; If Elijah's not inside trap area. NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahFightOutTravel; ; Add AI Package to Elijah to path to Fight Outside spot. Set bElijahTaunted to 1; ; We artificially set this variable, as if Player had taunted Elijah to fight (or Elijah expected a fight). Else ; Otherwise, if Elijah's inside trap area. NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahFightInsideTravel; ; Add AI Package to Elijah to fight inside the Vault's Chamber (trape area). Set bElijahTaunted to 0; ; We set this variable, as if Player had tricked Elijah to talk face to face, even though it was already 0 (precaution... dear friends). Endif ; Otherwise, the script at bElijahState 2 will assume that he's not made it inside the Vault Chamber (trap area) yet. Set iElijahState to 2; ; Ready Elijah for the next stage of events/AI behaviors (2 = Fight Outside). Set bElijahFights to 1; ; Set variable to be checked by Elijah's AI package (to avoid AddScriptPackage calls). Set iCount to 0; ; Reset operational integer. Return; Endif Endif Endif Endif Endif Elseif (iElijahState == 2) ; If Elijah's state is \"Alerted to a Trap,\" or planning to trap Player. If (NVDLC01ElijahRef.GetDead == 0) ; If Elijah lives during the combat scene. If (iSecurityState == 0) ; If Vault Security is off. If (bElijahTurnsSecurityOn == 1) ; If Elijah turns security before going into the trap area. Set fTimer to (fTimer + GetSecondsPassed) ; Then we kick-off the scene where he traps Player inside Vault, and fires security. If (iCount == 0 || iCount == 4) ; The second value of iCount gets set to 4 in the event of players rushing up the pod-stairs before Elijah can detect. NVDLC01ElijahREF.PlayIdle PipboyManipulate; Set iCount to 1; Return; Elseif (iCount == 1 && fTimer >= 1) VaultSecurityExitDoorsMarker.Enable; VaultPeskyFieldREF.MoveTo VaultPeskyFieldOnMarker; VaultPeskyFieldBlocker2REF.Enable; VaultPeskyFieldBlocker3REF.Enable; VaultPeskyField03bREF.SetPos Z 10406.0000; Set iCount to 2; Return; Elseif (iCount == 2 && fTimer >= 3) VaultSecurityMeasuresMarker.Enable; VaultFinalSpeaker01REF.SetDestroyed 0; VaultFinalSpeaker02REF.SetDestroyed 0; VaultFinalSpeaker01REF.Activate Player 1; VaultFinalSpeaker02REF.Activate Player 1; VaultFinalSpeaker01REF.SetDestroyed 1; VaultFinalSpeaker02REF.SetDestroyed 1; Set iCount to 3; Return; Elseif (iCount == 3 && fTimer >= 5) VaultFinalTurret01REF.SetGhost 0; VaultFinalTurret02REF.SetGhost 0; VaultFinalTurret03REF.SetGhost 0; VaultFinalTurret04REF.SetGhost 0; VaultFinalTurret05REF.SetGhost 0; VaultFinalTurret06REF.SetGhost 0; SetEnemy NVDLC01VaultSecurityFaction PlayerFaction 0 1; Set iCount to 0; Set fTimer to 0; Set iSecurityState to 2; Return; Endif Else ; If Elijah has not turned security at force-field before going into the trap area. If (bPlayerBlocks == 1) ; If player tries to go up the stairs, while Elijah's is alerted to the trap. If (bElijahTaunted != 1) ; If Elijah was tricked, before he was alerted If (iCount == 0) ; Then this means Elijah went into the Vault proper area (otherwise, state would've been skipped above, in iElijahState == 1). NVDLC01ElijahREF.RemoveScriptPackage NVDLC01VaultElijahFightOutTravel; ; We take the AI to travel outside the trap (it's possible, but not necessary, that this was overriden before, in iElijahState == 1). Set iCount to 1; Return; Elseif (iCount == 1) NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahFightInsideTravel; ; We give AI to travel inside the trap, to fight (it's possible, but not necessary, that this was given before, in iElijahState == 1). Set iCount to 2; Return; Elseif (iCount == 2) Set fAngle to (NVDLC01ElijahREF.GetAngle Z + NVDLC01ElijahREF.GetHeadingAngle Player); NVDLC01ElijahREF.SetAngle Z fAngle; NVDLC01ElijahREF.PlayIdle PipboyManipulate; Set bElijahTurnsSecurityOn to 1; Set iSecurityState to 5; ; We skip down to segment that handles Elijah's fight, under \"improvised\" circumstances. Set iCount to 0; Set fTimer to 0; Return; Endif Else ; If Elijah was expecting a trap, and player goes up the stairs to the pod. If (iCount == 0) VaultSecurityExitDoorsMarker.Enable; ; We lock the door, and set the code to run, idly - soon Elijah will reach the gate. Set iCount to 4; ; And he'll set the security sequence where he traps the player (scripted immediately above). Return; Elseif (iCount == 4) Return; Endif Endif Endif Endif Elseif (iSecurityState == 1) ; If Vault Security is on when Elijah gets there - this state also gets set if Elijah triggers trap, and players are not in safe-zone (trapped too). If (bElijahTurnsSecurityOn == 1) Set fTimer to (fTimer + GetSecondsPassed); If (iCount == 0) NVDLC01ElijahREF.PlayIdle PipboyManipulate; Set iCount to 1; Return; Elseif (iCount == 1 && fTimer >= 1) Set iCount to 0; Set fTimer to 0; Set iSecurityState to 2; Return; Endif Endif Elseif (iSecurityState == 2) If (iTurretsDown < 9) If (bChristineHelp == 0 && iTurretsDown < 6) ; Christine helps out by taking down two turrets (only runs here if Elijah sets trap on player, and less than 3 turrets are down). If (NVDLC01ChristineRef.GetDead == 0 && NVDLC01ChristineDialogue.nChristineAttitude > 1) VaultChristineVoiceActivatorREF.Say NVDLC01ChristineVaultHelpTopic01 1; Set bChristineHelp to 1; Endif Endif If (iTurretsDown == 1) If (iCount == 0) NVDLC01ElijahREF.SayTo Player NVDLC01ElijahVaultSentryDownTopic01 1; ; Elijah's bark about futility of Players' actions, blah blah. Set iCount to 1; Endif Elseif (iTurretsDown == 2) If (iCount <= 1) NVDLC01ElijahREF.SayTo Player NVDLC01ElijahVaultSentryDownTopic02 1; ; Elijah's bark about getting pissed off. Set iCount to 2; Endif Elseif (iTurretsDown >= 3) If (iCount <= 2) NVDLC01ElijahREF.SayTo Player NVDLC01ElijahVaultSentryDownTopic03 1; ; Elijah's bark about having to finish this off himself. VaultSecurityExitDoorsMarker.Disable; NVDLC01ElijahRef.MoveTo VaultElijahFightsInsidePortPoint; Set iSecurityState to 3; Set iCount to 0; Return; Endif Endif Else ; This variable (iTurretsDown) gets set to 9 if players re-program the turrets to attack Elijah. NVDLC01ElijahREF.SayTo Player NVDLC01ElijahVaultSentryDownTopic03 1; ;VaultSecurityExitDoorsMarker.Disable; NVDLC01ElijahRef.MoveTo VaultElijahFightsInsidePortPoint; Set iSecurityState to 3; Set iCount to 0; Return; Endif Elseif (iSecurityState == 3) NVDLC01ElijahRef.SetGhost 0; SetEnemy NVDLC01ElijahFaction PlayerFaction 0 1; NVDLC01ElijahRef.StartCombat Player; NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahRushInsideTravel; Set iSecurityState to 4; Return; Elseif (iSecurityState == 4) ; This is the standard fighting state, after players deal with enough security turrets, if Elijah trapped player Set fTimer to (fTimer + GetSecondsPassed); ; inside the Vault's Chamber area, of if he was trapped inside alongside the player. If (iCount == 0 && fTimer >= 0.5) VaultSecurityExitDoorsMarker.Enable; VaultPeskyFieldREF.MoveTo VaultPeskyFieldOnMarker; VaultPeskyFieldBlocker2REF.Enable; VaultPeskyFieldBlocker3REF.Enable; VaultPeskyField03bREF.SetPos Z 10406.0000; Set iCount to 1; If (bDeanHelp == 0) ; Dean helps out by disabling the speakers. If (NVDLC01DeanRef.GetDead == 0 && NVDLC01DeanDialogue.nDeanAttitude > 1) VaultDeanVoiceActivatorREF.Say NVDLC01DeanVaultHelpTopic01 1; Set bDeanHelp to 1; Endif Endif Return; Elseif (iCount == 1 && fTimer >= 6) NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic01 1; Set iCount to 2; Return; Elseif (iCount == 2 && fTimer >= 12) If (bChristineHelp == 0) ; Christine helps out by taking down two turrets (only runs here if 3 turrets were down before Elijah sets trap on player). If (iTurretsDown < 6) ; Only destroy turrets if at least one of them remains intact, and won't run if players have turned turrets against Elijah (variable == 9). If (NVDLC01ChristineRef.GetDead == 0 && NVDLC01ChristineDialogue.nChristineAttitude > 1) VaultChristineVoiceActivatorREF.Say NVDLC01ChristineVaultHelpTopic01 1; ; In her dialogue, a variable gets set to 1 in the VaultTurretCodeBox. The code to kill the turrets runs there. Set bChristineHelp to 1; Endif Endif Endif Elseif (iCount == 2 && fTimer >= 20) NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic02 1; Set iCount to 3; Return; Elseif (iCount == 3 && fTimer >= 40) NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic03 1; Set iCount to 4; Return; Elseif (iCount == 4 && fTimer >= 60) NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic04 1; Set iCount to 5; Return; Elseif (iCount == 6) Return; Endif Elseif (iSecurityState == 5) ; This case only takes place if players sneak behind Elijah, through the main exit stairs, when he's been duped to head to the Set fTimer to (fTimer + GetSecondsPassed); ; Vault's chamber. If (iCount == 0) VaultSecurityExitDoorsMarker.Enable; VaultPeskyFieldREF.MoveTo VaultPeskyFieldOnMarker; VaultPeskyField03bREF.SetPos Z 10406.0000; VaultPeskyFieldBlocker2REF.Enable; VaultPeskyFieldBlocker3REF.Enable; VaultSecurityMeasuresMarker.Enable; VaultFinalSpeaker01REF.SetDestroyed 0; VaultFinalSpeaker02REF.SetDestroyed 0; VaultFinalSpeaker01REF.Activate Player 1; VaultFinalSpeaker02REF.Activate Player 1; VaultFinalSpeaker01REF.SetDestroyed 1; VaultFinalSpeaker02REF.SetDestroyed 1; Set iCount to 1; Return; Elseif (iCount == 1 && fTimer >= 2) VaultFinalTurret01REF.SetGhost 0; VaultFinalTurret02REF.SetGhost 0; VaultFinalTurret03REF.SetGhost 0; VaultFinalTurret04REF.SetGhost 0; VaultFinalTurret05REF.SetGhost 0; VaultFinalTurret06REF.SetGhost 0; SetEnemy NVDLC01VaultSecurityFaction PlayerFaction 0 1; If (bDeanHelp == 0) ; Dean helps out by disabling the speakers. If (NVDLC01DeanRef.GetDead == 0 && NVDLC01DeanDialogue.nDeanAttitude > 1) VaultDeanVoiceActivatorREF.Say NVDLC01DeanVaultHelpTopic01 1; Set bDeanHelp to 1; Endif Endif Set iCount to 2; Return; Elseif (iCount == 2 && fTimer >= 4) NVDLC01ElijahRef.SetGhost 0; SetEnemy NVDLC01ElijahFaction PlayerFaction 0 1; NVDLC01ElijahRef.StartCombat Player; Set iCount to 3; Set fTimer to 0; Return; Elseif (iCount == 3 && fTimer >= 6) NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic01 1; Set iCount to 4; Return; Elseif (iCount == 4 && fTimer >= 12) If (bChristineHelp == 0) If (iTurretsDown < 6) If (NVDLC01ChristineRef.GetDead == 0 && NVDLC01ChristineDialogue.nChristineAttitude > 1) VaultChristineVoiceActivatorREF.Say NVDLC01ChristineVaultHelpTopic01 1; Set bChristineHelp to 1; Endif Endif Endif Elseif (iCount == 4 && fTimer >= 20) NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic02 1; Set iCount to 5; Return; Elseif (iCount == 5 && fTimer >= 40) NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic03 1; Set iCount to 6; Return; Elseif (iCount == 6 && fTimer >= 60) NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic04 1; Set iCount to 7; Return; Elseif (iCount == 7) Return; Endif Endif Else ; If Elijah's dead while the combat scene takes place. If (bElijahDead == 0) VaultFinalTurret01REF.SetGhost 0; ; Make security turrets vulnerable, just in case Elijah dies before they get set to Ghost 0. VaultFinalTurret02REF.SetGhost 0; VaultFinalTurret03REF.SetGhost 0; VaultFinalTurret04REF.SetGhost 0; VaultFinalTurret05REF.SetGhost 0; VaultFinalTurret06REF.SetGhost 0; Set iCount to 0; ; Reset operational variables to use in scripting for Elijah's death-event. Set fTimer to 0; Set bElijahDead to 1; ; This variable is important to set to 1 - dialogue will check against this (Veronica). Set iElijahState to 4; ; Set script to handle Elijah's death-event next. Return; Endif Endif Elseif (iElijahState == 3) ; Elijah's tricked into opening the Vault, or Elijah discovers the trap before players spring it on him. If (iSecurityState == 0) ; If Vault Security is off, or Elijah hasn't been alarmed by player actions yet. If (bElijahTurnsSecurityOn == 1) ; If Elijah is done with using terminal animations Set fTimer to (fTimer + GetSecondsPassed); ; We kick off a timer to handle timing of events where Elijah triggers Vault security. If (NVDLC01ElijahREF.IsInCombat == 0) ; If Elijah's not in combat If (iCount == 0) ;NVDLC01ElijahRef.SetGhost 0; ; At this point, Elijah's vulnerable. Set iCount to 1; Return; Elseif (iCount == 1 && fTimer >= 1) VaultSecurityExitDoorsMarker.Enable; VaultPeskyFieldREF.MoveTo VaultPeskyFieldOnMarker; VaultPeskyField03bREF.SetPos Z 10406.0000; VaultPeskyFieldBlocker2REF.Enable; VaultPeskyFieldBlocker3REF.Enable; VaultEntryDoor02REF.SetOpenState 0; VaultEntryDoor01REF.SetOpenState 0; Set iCount to 2; Return; Elseif (iCount == 2 && fTimer >= 1.5) Set fAngle to (NVDLC01ElijahREF.GetAngle Z + NVDLC01ElijahREF.GetHeadingAngle VaultElijaVaultFightOutMarkerREF); NVDLC01ElijahREF.SetAngle Z fAngle; NVDLC01ElijahRef.Say NVDLC01ElijahVaultTrappedTopic01 1; Set iCount to 3; Return; Elseif (iCount == 3 && fTimer >= 4.5) VaultSecurityMeasuresMarker.Enable; VaultFinalSpeaker01REF.SetDestroyed 0; VaultFinalSpeaker02REF.SetDestroyed 0; VaultFinalSpeaker01REF.Activate Player 1; VaultFinalSpeaker02REF.Activate Player 1; VaultFinalSpeaker01REF.SetDestroyed 1; VaultFinalSpeaker02REF.SetDestroyed 1; Set iCount to 4; Return; Elseif (iCount == 4 && fTimer >= 5) Set fAngle to (NVDLC01ElijahREF.GetAngle Z + NVDLC01ElijahREF.GetHeadingAngle VaultFinalSpeaker01REF); NVDLC01ElijahREF.SetAngle Z fAngle; NVDLC01ElijahRef.Say NVDLC01ElijahVaultTrappedTopic02 1; Set iCount to 5; Return; Elseif (iCount == 5 && fTimer >= 5.5) NVDLC01ElijahREF.PlayIdle LooseWildlyAngryShortLength; Set iCount to 6; Return; Elseif (iCount == 6 && fTimer >= 11) Set fAngle to (NVDLC01ElijahREF.GetAngle Z + NVDLC01ElijahREF.GetHeadingAngle Player); NVDLC01ElijahREF.SetAngle Z fAngle; NVDLC01ElijahREF.PlayIdle PipboyManipulate; NVDLC01ElijahRef.Say NVDLC01ElijahVaultTrappedTopic03 1; VaultFinalTurret01REF.AddScriptPackage NVDLC01VaultTurretFakeAttackElijah; VaultFinalTurret02REF.AddScriptPackage NVDLC01VaultTurretFakeAttackElijah; VaultFinalTurret03REF.AddScriptPackage NVDLC01VaultTurretFakeAttackElijah; VaultFinalTurret06REF.AddScriptPackage NVDLC01VaultTurretFakeAttackElijah; Set iCount to 0; Set fTimer to 0; Set iSecurityState to 1; Return; Endif Else ; This means that Elijah started combat, which can only happen if his Ghost state is 0, which means he opened the Vault. If (VaultSecurityMeasuresMarker.GetDisabled == 1) ; If the previous sequence didn't get to this point, then enable the security of the Vault. VaultSecurityMeasuresMarker.Enable; ; Note: this state is a safeguard against extremely fringe-like cases (detonators, mines, etc, that may hurt Elijah here). VaultFinalSpeaker01REF.SetDestroyed 0; VaultFinalSpeaker02REF.SetDestroyed 0; VaultFinalSpeaker01REF.Activate Player 1; VaultFinalSpeaker02REF.Activate Player 1; VaultFinalSpeaker01REF.SetDestroyed 1; VaultFinalSpeaker02REF.SetDestroyed 1; Endif NVDLC01ElijahRef.Say NVDLC01ElijahVaultTrappedTopic03 1; ; Elijah kickstarts the event where he's aware of the trap/combat, and he's in the Vault Chamber area. Set iCount to 0; ; We skip to where we check for player positions (out of trap, or inside trap area), and let it run its expected course (below). Set fTimer to 0; ; Again, this is highly unlikely. Set iSecurityState to 1; Return; Endif Endif Elseif (iSecurityState == 1) ; Here we check for players' position. If they are safe, then Elijah's trapped. Also, this stage is a fall-through for \"trap-discovered!\" If (bPlayerSafe == 1) || (bElijahTrapped == 1) ; bPlayerSafe is passed by an actor-zone that stands beyond the security force-fields, near entry pod, and retraversal path pod. Set fTimer to (fTimer + GetSecondsPassed); ; However, we also check for bElijahTrapped == 1. We want this to continue once it starts, regardless of subsequent player-actions. If (iCount == 0) NVDLC01ElijahRef.SetGhost 0; Set bElijahTrapped to 1; ; Set Elijah to be formally \"trapped.\" VaultMaintenanceDoorREF.Unlock; NVDLC01VaultElevatorREF.Unlock; PlaySound NVDLC01AMBVaultEscapeStart; Set iCount to 1; Return; Elseif (iCount == 1 && fTimer >= 6) NVDLC01ElijahRef.Say NVDLC01ElijahVaultTrappedTopic04 1; NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahTrappedCurseTravel; Set NVDLC01Collars to 0; ; We disable the standard collar functions. Set VaultCollarCodeBox.bCollarOn to 1; ; Elijah's pissed off now - he triggers the player's bomb-collar (this runs in the Vault level only). VaultEscapeSoundMarker.Enable; VaultEntryDoor02REF.SetOpenState 0; VaultEntryDoor01REF.SetOpenState 0; Set iCount to 2; Return; Elseif (iCount == 2 && fTimer >= 6.5) Set iCount to 3; Return; Elseif (iCount == 3 && fTimer >= 7) PlayMusic NVDLC01EndGameEscape; NVDLC01ElijahRef.SetGhost 0; VaultFinalTurret01REF.SetGhost 0; VaultFinalTurret02REF.SetGhost 0; VaultFinalTurret03REF.SetGhost 0; VaultFinalTurret04REF.SetGhost 0; VaultFinalTurret05REF.SetGhost 0; VaultFinalTurret06REF.SetGhost 0; SetEnemy NVDLC01VaultSecurityFaction PlayerFaction 0 1; VaultFinalTurret01REF.StartCombat Player; VaultFinalTurret02REF.StartCombat Player; VaultFinalTurret03REF.StartCombat Player; VaultFinalTurret04REF.StartCombat Player; VaultFinalTurret05REF.StartCombat Player; VaultFinalTurret06REF.StartCombat Player; Set iCount to 4; Set fTimer to 60.5; ; Players have 60 seconds to get to the elevator before it leaves. Return; Elseif (iCount == 4) If (iElevatorState == 0) Set fTimer to (fTimer - GetSecondsPassed); If (fTimer <= 0) Set iElevatorState to 1; ; Elevator leaves when the timer runs out. Return; Endif Endif Endif Else ; If Player is not in safe-zone when Elijah triggers the Vault's Security System. VaultFinalTurret01REF.SetGhost 0; VaultFinalTurret02REF.SetGhost 0; VaultFinalTurret03REF.SetGhost 0; VaultFinalTurret04REF.SetGhost 0; VaultFinalTurret05REF.SetGhost 0; VaultFinalTurret06REF.SetGhost 0; NVDLC01ElijahRef.SetGhost 0; SetEnemy NVDLC01VaultSecurityFaction PlayerFaction 0 1; Set bElijahFights to 1; ; We kick back the script to the fall-through stage (Elijah Fight Scene). Set iElijahState to 2; Set iSecurityState to 3; Endif Endif Elseif (iElijahState == 4) ; Elijah's dead - end scene, reset variables, do groovy stuff. Set fTimer to (fTimer + GetSecondsPassed) If (iCount == 0 && fTimer >= 1) VaultFinalTurret01REF.PlaceAtMe NV40mmGrenadeExplosion; VaultSecurityMeasuresMarker.Disable; VaultFinalSpeaker01REF.SetDestroyed 0; VaultFinalSpeaker02REF.SetDestroyed 0; VaultFinalSpeaker01REF.Activate Player 1; VaultFinalSpeaker02REF.Activate Player 1; VaultFinalSpeaker01REF.SetDestroyed 1; VaultFinalSpeaker02REF.SetDestroyed 1; VaultPeskyFieldREF.MoveTo VaultPeskyFieldOffMarker; VaultPeskyField03bREF.SetPos Z 7406.0000 VaultPeskyFieldBlocker2REF.Disable; VaultPeskyFieldBlocker3REF.Disable; Set iCount to 1; Return; Elseif (iCount == 1 && fTimer >= 1.4) VaultFinalTurret03REF.PlaceAtMe NV40mmGrenadeExplosion; ;VaultFinalTurret01REF.KillActor Player 0 VaultFinalTurret01REF.CIOS NVDLC01KillSpell; Set iCount to 2; Return; Elseif (iCount == 2 && fTimer >= 2.4) VaultFinalTurret02REF.PlaceAtMe NV40mmGrenadeExplosion; VaultFinalTurret03REF.CIOS NVDLC01KillSpell; Set iCount to 3; Return; Elseif (iCount == 3 && fTimer >= 3.4) VaultFinalTurret05REF.PlaceAtMe NV40mmGrenadeExplosion; VaultFinalTurret02REF.CIOS NVDLC01KillSpell; Set iCount to 4; Return; Elseif (iCount == 4 && fTimer >= 3.6) VaultFinalTurret06REF.PlaceAtMe NV40mmGrenadeExplosion; VaultFinalTurret05REF.CIOS NVDLC01KillSpell; Set iCount to 5; Return; Elseif (iCount == 5 && fTimer >= 3.9) VaultFinalTurret04REF.PlaceAtMe NV40mmGrenadeExplosion; VaultFinalTurret06REF.CIOS NVDLC01KillSpell; Set iCount to 6; Return; Elseif (iCount == 6 && fTimer >= 4.8) VaultFinalSpeaker01REF.PlaceAtMe NV40mmGrenadeExplosion; VaultFinalTurret04REF.CIOS NVDLC01KillSpell; Set iCount to 7; Return; Elseif (iCount == 7 && fTimer >= 5.1) VaultFinalSpeaker02REF.PlaceAtMe NV40mmGrenadeExplosion; ;VaultSecurityExitDoorsMarker.Disable; VaultPeskyFieldREF.MoveTo VaultPeskyFieldOffMarker; VaultPeskyFieldBlocker2REF.Disable; Set NVDLC01Collars to 0; ; We disable the standard collar functions. Set VaultCollarCodeBox.bCollarOn to 1; ; Elijah dies, and that automatically triggers the player's bomb-collar (this runs in the Vault level only). VaultEscapeSoundMarker.Enable; VaultMaintenanceDoorREF.Unlock; ; We make sure the doors leading out are unlocked, and some of them are to be closed (freak out time, when collar's ticking). NVDLC01VaultElevatorREF.Unlock; VaultEntryDoor02REF.SetOpenState 0; VaultEntryDoor01REF.SetOpenState 0; Set iCount to 8; Return; Endif Endif Endif Endif Endif End ; <<<<----------------"; // result will be an iterator over tuples containing the start and end indices for each match in the string let result = regex.captures_iter(string); for mat in result { println!("{:?}", mat); } }

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 Rust, please visit: https://docs.rs/regex/latest/regex/