050-730 practice question 4 of 25
Using regular expressions, which matches ‘a’ or ‘b’?
Full set: 117 questionsIn regular expressions, the vertical bar | acts as an alternation operator, which is equivalent to a logical "OR". The expression a|b instructs the regular expression engine to match either the character or sub-expression on its left (a) or the character or sub-expression on its right (b). This is the standard syntax for matching one of several alternatives. Therefore, a|b is the correct expression to match either the character ‘a’ or the character ‘b’.
A. “a\b”: The \b is a word boundary anchor. This expression matches the character 'a' only when it is at the end of a word.
B. “a.b”: The dot . is a wildcard that matches any single character. This expression matches a three-character string starting with 'a' and ending with 'b'.
C. “ab”: The asterisk is a quantifier meaning "zero or more" of the preceding element. This matches strings like 'b', 'ab', 'aab', and so on.
E. “a:b”: The colon : is treated as a literal character. This expression matches only the exact three-character string "a:b".
1. Micro Focus UFT One Help Center: In the "Regular Expression Character and Operator Reference," the | character is defined as: "Matches either the expression before or the expression after the |. For example, z|food matches z or food." This directly confirms the use of | for alternation. (Source: Micro Focus UFT One 2023 Help Center, Section: "Regular Expression Character and Operator Reference").
2. Micro Focus LoadRunner Professional Help Center: The documentation on "Regular Expression Syntax" specifies that LoadRunner uses Perl 5 compatible regular expressions. It defines | as the alternation operator: "Matches one of a series of patterns. For example, cat|dog matches cat or dog." (Source: Micro Focus LoadRunner Professional 2023 Help Center, Section: "Vuser Scripts > Regular Expressions in VuGen > Regular Expression Syntax").
3. MIT OpenCourseWare: In the course materials for 6.035 Computer Language Engineering, regular expression operations are formally defined. The alternation (or union) operator | is specified as r1 | r2, which denotes a match for a string in the language of r1 or a string in the language of r2. (Source: MIT OCW, 6.035 Computer Language Engineering, Spring 2010, Lecture 2 Notes, Section 2.2 "Regular Expressions").
Keep practicing
Take the free 050-730 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other 050-730 practice questions
- Question 1Which statements about the Integrated Installer are true? (Choose 2.)
- Question 2Which are some best practices for using version control with Designer? (Choose 2.)
- Question 3In the Standard SoD Constraint Exception Approval Workflow Activity, which Activity Name …
- Question 5In the Navigation Access Permissions page, who has access to the administration tab? (Cho…
- Question 6Which rules need to be followed when adding activities to a workflow? (Choose 3.)
- Question 7What is the naming convention for a Global Configuration Value (GCV)?
