Question: Write a regular expression that matches a substring of the following pattern, where the components listed top-down here should appear left-to-right in a matched string,
Write a regular expression that matches a substring of the following pattern, where the components listed top-down here should appear left-to-right in a matched string, The pattern need not match at the beginning of the string, but it should go all the way to the end of the string "Age: Zero or more whitespace characters A non-zero digit then up to two more digits. Capture this group. One or more whitespace characters "D" Zero or more whitespace characters One uppercase letter then three digits. Capture this group, For example, where the value of p is the Regexobject instance that results from compiling the regular expression, we have the following interaction >>> - p.search('my Age: 67 ID: C123) >>> roupa () (67, C123) The following are examples of strings that are not matched by this pattern. "your Age: 67 ID: C1234" The substring C123" is not at the end of the string "Age: 67. ID: C123 The comma is not allowed Note that we are asking for the regular expression and nothing more Write a regular expression that matches a substring of the following pattern, where the components listed top-down here should appear left-to-right in a matched string, The pattern need not match at the beginning of the string, but it should go all the way to the end of the string "Age: Zero or more whitespace characters A non-zero digit then up to two more digits. Capture this group. One or more whitespace characters "D" Zero or more whitespace characters One uppercase letter then three digits. Capture this group, For example, where the value of p is the Regexobject instance that results from compiling the regular expression, we have the following interaction >>> - p.search('my Age: 67 ID: C123) >>> roupa () (67, C123) The following are examples of strings that are not matched by this pattern. "your Age: 67 ID: C1234" The substring C123" is not at the end of the string "Age: 67. ID: C123 The comma is not allowed Note that we are asking for the regular expression and nothing more
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
