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

r"
"
g

Test String

Code Generator

Generated Code

re = /(\d[\w\W]*?(?=(?:\d\d*\. )|$))/ str = '1. A DDR4 DIMM with a PC rating of PC4-17000 is running at what speed? a. 1800 MHz b. 2000 MHz c. 2133 MHz d. 3000 MHz 2. What can a DIMM use to hold data and amplify a signal just before the data is written to the module? a. EDO b. registers c. parity d. CAS 3. A DDR4 DIMM running at a speed of 2666 MHz has what PC rating? a. PC4-17000 b. PC4-24000 c. PC4-21300 d. PC4-30000 4. DIMMs used in servers can provide additional reliability if they use what specific technology? a. EDO b. dual ranked c. ECC d. PC3 5. Which statement is true regarding DIMM technologies? a. DDR2 uses 184 pins b. DDR3 is backward compatible with DDR2 c. SDRAM runs synchronized with the system clock d. the S in SDRAM stands for static 6. What is the transfer rate of a 64-bit module running at 1600 MHz? a. 1600 MB/second b. 3200 MB/second c. 6400 MB/second d. 12800 MB/second 7. What should you install in a server room that will save space by allowing you to control multiple servers with a single mouse, keyboard, and monitor? a. a MIDI connector b. a digitizer c. biometric device d. a KVM switch 8. What is the current maximum storage capacity limit of a magnetic tape? a. 500GB b. 15TB c. 185TB d. 300TB 9. A DAT72 tape is also known by what term? a. DDS-2 b. DDS-3 c. DDS-4 d. DDS-5 10. Three long beeps during the POST sequence on an Intel BIOS are an indication of what type of issue? a. motherboard problem b. memory error c. system overheat d. keyboard controller problem 11. What does a single beep or no beep imply during the startup of a computer? a. a video problem b. a memory error c. all POST tests passed d. a keyboard controller problem 12. If you see an error message that reads "Processor thermal trip error", what is the likely problem? a. the power supply is inadequate b. the processor has overheated c. the processor has failed d. a memory module might be bad 13. If the startup BIOS can\'t find a device to use to load the operating system, what error message is likely to appear? a. Fixed disk error b. Blue screen of death c. Error in ntoskernel d. Error loading Windows 14. What type of backlighting receives DC power directly from a motherboard and doesn\'t use an inverter? a. CCFL b. LED c. Plasma d. OLED 15. What type of backlighting is also called fluorescent backlighting, and was first used in laptop monitors? a. LED b. liquid crystal display c. plasma monitor d. CCFL 16. What is the distance between adjacent dots on a screen known as? a. viewing angle b. refresh rate c. native resolution d. pixel pitch 17. What component of a processor handles all logical comparisons and calculations inside the processor? a. ALU b. register c. bus d. control unit 18. A processor housing that contains more than one processor is referred to as what term? a. multithreaded processor b. multicore processor c. multiprocessing processor d. multihoused processor 19. Hybrid processors that can process 32 bits or 64 bits are known by what term? a. x86 processors b. Itanium processors c. Dual Mode processors d. x86-64 processors 20. What component of a processor holds instructions waiting to be processed by the ALU? a. register b. bus c. internal memory cache d. control unit 21. What is a typical symptom of a CMOS battery failure? a. POST code beeps b. time and date settings lost c. continuous reboots d. blue screen of death 22. When a static image stays on a monitor for many hours leaving a permanent impression of that image on the monitor, what term is used to describe the condition? a. image cling b. burn-in c. screen blanking d. screen freezing 23. When might an LCD monitor experience distorted geometry? a. only when the wrong video cable is used b. if the pixel pitch is not high enough c. if the screen is overheating d. the screen is not set to native resolution 24. What term refers to horizontally torn images on a screen, which occur when the video feed from the video controller gets out of sync with the refresh rate of the monitor? a. burn-in b. left-ins c. rips d. artifacts 25. What might be the cause of a black screen right after you install a new video card? a. no video card is detected b. the onboard video is not disabled in BIOS c. you installed the video card in the wrong slot d. the video card has insufficient RAM 26. What technology is used to assure that the logical block addressing on a solid state drive does not always address the same physical blocks, in order to distribute write operations? a. wear leveling b. bit shifting c. block sliding d. data migration 27. Which statement regarding hard drives is incorrect? a. the 3.5" size is typically used in desktops b. a solid state drive has no moving parts c. solid state drives are less expensive than magnetic hard drives d. tracks on a hard drive are divided into sectors 28. Which statement regarding the selection of a hard drive is accurate? a. a faster spindle speed keeps the drive cooler but doesn\'t improve performance b. PATA drives are backward compatible with SATA drives c. USB drives are a good choice for fast internal drives d. magnetic drives have larger capacity for the money than solid state drives 29. What hard drive technology is used to predict when a drive is likely to fail? a. S.S.D. b. S.M.A.R.T. c. N.A.N.D. d. E.E.P.R.O.M. 30. The hard drive firmware, UEFI/BIOS, and the OS address the sectors on a hard drive utilizing what technology? a. logical sector addressing b. low level formatting c. logical block addressing d. high level formatting 31. What process writes sector markings to a hard drive? a. partitioning b. low-level formatting c. high-level formatting d. sector provisioning 32. Which rotation speed is not a typical spindle rotation speed for magnetic hard drives? a. 3100 b. 5400 c. 7200 d. 10000 33. What type of processor memory is located on the processor chip (processor die)? a. Level 0 cache b. Level 1 cache c. Level 2 cache d. Level 3 cache 34. What type of RAM is typically installed onto a motherboard and loses data rapidly, requiring it to be refreshed often? a. SRAM b. CMOS RAM c. DRAM d. Flash RAM 35. Where can the Execute Disable Bit (EDB) technology be disabled? a. In the EDB configuration software. b. In the BIOS / UEFI setup screen c. In the Windows Device Driver screen d. In the Windows command line EDB utility 36. What is the general name of the processor feature that AMD calls HyperTransport? a. multicore processing b. multithreading c. virtualization support d. integrated graphics 37. Involving both software and hardware, what technology is meant to protect digital content and prevent piracy? a. HDMI b. DRM c. PPM d. DVI 38. Which type of video port provides a digital-only signal? a. DVI-I b. DVI-D c. DVI-A d. VGA 39. What should you do if the system continually reboots and you can\'t read the error message produced on a blue screen? a. press F8 as Windows starts up b. press Pause so you can see the screen output c. press Ctrl+Print Screen to print the screen output d. press Esc as soon as you see the blue screen 40. One long and two short beeps when using an Award BIOS is an indication of what issue? a. memory error b. hard drive not found c. a video problem d. a CPU problem 41. What is an auto-switching AC adapter? a. an adapter that can switch between line power and battery power b. an adapter that switches between two PCs c. an adapter that can use 110V or 220V AC power d. an adapter that can switch between AC or DC 42. A missing standoff could create what potential problem? a. a short on the motherboard b. the computer boots, but can\'t connect to the network c. data is deleted from the hard drive d. you see lines on the video monitor 43. What is an indication that an inadequate power supply is the source of an intermittent problem? a. the power supply whines when you first turn on the system b. you don\'t see any indicator lights or fans spinning c. BIOS loses its date and time settings d. the system tries to boot from the wrong device 44. Which of the following protects your computer from brownouts or sags? a. degaussing b. GPU c. surge protector d. UPS 45. When populating a motherboard with DIMM modules, what configuration option will not work? a. using two different manufacturer\'s memory b. mixing memory speeds c. leaving a slot unpopulated d. mixing unbuffered with registered 46. What component of a motherboard is not considered to be a field replaceable unit? a. processor b. RAM c. CMOS battery d. chipset 47. Why might you disable quick booting features in BIOS when you are troubleshooting a problem? a. to enable access the advanced boot menu b. quick booting prevents Windows from logging errors c. to see a full POST report d. quick booting bypasses the POST 48. Which statement regarding the USB standard and USB devices is accurate? a. up to 64 USB devices can be daisy chained together b. USB uses parallel data transmissions c. a USB cable has four wires, two for power and two for communication d. USB devices must supply their own power 49. A SuperSpeed USB port is capable of attaining what maximum data transfer speed? a. 1.2 Gbps b. 1.5 Gbps c. 5 Gbps d. 6 Gbps 50. Which statement regarding the Firewire standard is accurate? a. data is transferred on a parallel bus b. 1394b allows up to 16 daisy-chained devices c. FireWire 800 uses a 4-pin connector d. FireWire devices are hot-swappable 51. If you are trying move a hard drive from a non-working computer to a working computer for the purposes of accessing the data on the drive, what must you have? a. you must install the drive in a drive bay b. you must manually assign a drive letter c. you must have an Administrator password before you can access the data on the drive d. the drive must be initialized before you can access it 52. What technology in a DIMM informs the BIOS of the module\'s size, speed, voltage, and data path width? a. SPD b. ECC c. Buffers d. DDR 53. If a computer is performing slowly due to file fragmentation, what Windows tool can be utilized to rearrange fragments? a. Computer Management b. defragmentation tool c. defraggler d. Disk cleanup 54. Which of the following is NOT the name of a current family of Intel processors? a. Duo b. Core c. Atom d. Celeron 55. What Intel processor technology interconnects the processor, chipset, and wireless network adapter as a unit, improving laptop performance? a. Pentium b. Core i5 c. Celeron d. Centrino 56. What happens when a flash memory card is installed in a slot and it is recognized by Windows? a. a window appears prompting you to initialize the device b. a drive letter is assigned to the device and you can see it in Explorer c. Windows automatically partitions and formats the device d. the files are copied from the device to your Documents folder 57. A PCIe 6/8 pin connector for providing auxiliary power to PCIe cards utilizes what voltage? a. +5v b. -12V c. +12v d. +15v 58. What is the most used rail on a power supply? a. +3.3V b. -5V c. -12V d. +12V 59. Which of the following is NOT a solution to an overheating problem? a. verify that cables are not obstructing airflow b. remove the covers from empty expansion slots c. be sure the case is not sitting on a carpet d. remove dust from the power supply, vents, and cooler fans 60. If you suspect your system is overheating, how can you determine the CPU temperature? a. in Windows, go to System Information b. the CPU has a temperature display screen c. press a room thermometer on the top of the CPU d. go into UEFI/BIOS setup and find the temperature monitors for the system 61. What statement best describes a RAID 5? a. data from one drive is mirrored to another b. it improves performance but not fault tolerance c. it requires 3 or more drives and uses parity checking d. it takes at least four disks and data is striped and mirrored 62. Which type of RAID volume is used for fault tolerance and only requires two drives? a. RAID0 b. RAID1 c. RAID5 d. RAID10 63. What type of RAID is a combination of mirroring and striping? a. RAID0 b. RAID1 c. RAID5 d. RAID10 64. Why might you want to use a RAID 0 disk configuration? a. to improve overall disk performance b. RAID 0 drives are less expensive than other RAID drives c. to prevent data loss in case of a drive failure d. because RAID 0 provides an automatic disk backup 65. What Intel socket recommends the use of a liquid cooling system? a. LGA1150 b. LGA1151 c. LGA1750 d. LGA2011 66. Which type of memory can support quad, triple, and dual channels? a. DDR3 b. DDR2 c. DDR d. RIMM 67. If you are adding a hard drive to a system that already has a drive with Windows installed on it, what should you do? a. you should boot from the Windows setup DVD to prepare the new drive b. boot Windows and use Disk Management to prepare the new drive c. use the BIOS setup screen to partition and format the new drive d. check that the new hard drive must use the same standard as the Windows drive 68. What command line utility can be used to repair the BCD on a Windows installation? a. chkdsk b. fsutil c. dfrgl d. bootrec 69. The SATA/600 standard is also known by what other name? a. SATAI b. SATAII c. SATAIII d. SATA revision 4 70. What SATA standard provides a transfer rate of 3 Gb/sec? a. SATA1 b. SATA2 c. SATA3 d. SATA4 71. A SATA data cable has how many pins? a. 4 pins b. 7 pins c. 10 pins d. 15 pins 72. Which of the following is a requirement for supporting the Aero user interface? a. at least 128 KB video memory b. DirectX 9 or higher c. an HDMI video port d. Windows XP with SP3 73. In order to enable the Windows 7 Aero user interface, how much video memory must be available to the video controller? a. 64MB b. 128MB c. 256MB d. 1GB 74. What icon might you see in Device Manager that indicates a problem with a device? a. blue circle b. yellow triangle c. red square d. white oval 75. What is a basic principle that applies to both internal and external devices? a. when connecting a faster device to a slower port, the port adapts to the speed of the device b. if you have multiple devices to install, it\'s best to install them at the same time c. for most installations, install the device first, then the device driver d. some devices don\'t require a software component for them to work properly 76. When installing a new device, which statement is accurate? a. a mouse may not require an additional device driver installation b. Vista drivers never work with Windows 7 c. 32-bit drivers can be installed in a 64-bit OS d. 64-bit drivers can be installed in a 32-bit OS 77. How many layers of data can exist on a single side of a Blu-ray disc? a. 1 b. 2 c. 3 d. 4 78. What is the most likely result of a correctly installed processor, but an incorrectly installed cooler? a. powers on, but nothing else happens b. boot process begins, but system suddenly turns off after a short period c. system does not power on at all d. BIOS setup does not recognize the processor correctly 79. When testing a laptop power connector, how close should the voltage measured be to the accepted voltage of the laptop? a. +/- 10% b. +/- 5% c. +/- 1% d. The voltage should be exactly the same 80. If a user on a laptop complains that they are unable to sign into Windows even though they are certain they are entering the correct password, what should you have them do? a. perform a reboot b. bring the laptop to an authorized repair shop c. check the NumLock indicator on the laptop d. Replace the laptop keyboard ' # Print the match result str.scan(re) do |match| puts match.to_s end

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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html