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