SlideShare uma empresa Scribd logo
1 de 23
Regular Expressions



What is Regular Expressions ?



Common Scenarios where Regular Expressions are used



Regular Expression submatch String



Using Regular Expressions for Property Values



Using Regular Expressions in Checkpoints



Case Study



Session Wrap-Up
pgorantla.blogspot.com
Regular Expressions



A regular expression is a string that describes or matches a set of strings,
according to certain syntax rules.
or
A regular expression, often called a pattern, is an expression that describes a set
of strings. They are usually used to give a concise description of a set, without
having to list all elements.



Regular expressions are used by many text editors and utilities to search and
manipulate bodies of text based on certain patterns.



Many programming languages support regular expressions for string
manipulation.
For example, Perl has a powerful regular expression engine built directly into its
syntax.



The set of utilities (including the editor sed and the filter grep) provided by Unix
distributions were the first to popularize the concept of regular expressions.



The origin of regular expressions lies in Automata Theory and formal language
theory (both part of Theoretical Computer Science.



Can use regular expressions for :
- Defining the property values of an object in dialog boxes.
- Parameterizing a step.
- Creating checkpoints with varying values.
pgorantla.blogspot.com
Regular Expressions

1.

Using the Backslash Character



A backslash () instructs QuickTest to treat the next character as a literal
character, if it is otherwise a special character .



The backslash () can also instruct QuickTest to recognize certain ordinary
characters as special characters. Example: QuickTest recognizes n as the special
newline character.



Example:





 matches the literal character 
( matches the literal character (

Scenario: If you are looking for a Web site called:
mercurytours.mercuryinteractive.com the period would be mistaken as an
indication of a regular expression.
• To indicate that the period is not part of a regular expression, you would enter it
as follows:
mercurytours.mercuryinteractive.com

pgorantla.blogspot.com
Regular Expressions

2. Matching Any Single Character

 A period (.) instructs QuickTest to search for any single

character (except for n).
For example:
Welcome.

matches Welcomes, Welcomed, or Welcome followed by a
space or any other single character.
 A series of periods indicates the same number of unspecified

characters.

 To match any single character including n, enter:

(.|n)

pgorantla.blogspot.com
Regular Expressions

3. Matching Any Single Character in a List
•

Square brackets instruct QuickTest to search for any single character within a list of characters.

•

Example, to search for the date 2000, 2001, or 2002, enter:
200[012]

4. Matching Any Single Character Not in a List Iterative
constructs.
•

When a caret (^) is the first character inside square brackets, it instructs QuickTest to match any
character in the list except for the ones specified in the string.

•

Example:

[^ab]

matches any character except a or b.
Note: The caret has this special meaning only when it is displayed first within the brackets.

pgorantla.blogspot.com
Regular Expressions

5. Matching Any Single Character within a Range.
•

In order to match a single character within a range, you can use square brackets ([ ])
with the hyphen (-) character.

•

Example : To match any year in the 2000s, enter:
200[0-9]

6. Matching Zero or More Specific Characters Functions and subroutines.
•
•

An asterisk (*) instructs QuickTest to match zero or more occurrences of the
preceding character.
For example:
ca*r

matches car, caaaaaar, and cr.

pgorantla.blogspot.com
Regular Expressions

7. Matching One or More Specific Characters.
•

A plus sign (+) instructs QuickTest to match one or more occurrences of the
preceding character.

•

Example:
ca+r

matches car and caaaaaar, but not cr.

8. Matching Zero or One Specific Character.
•

A question mark (?) instructs QuickTest to match zero or one occurrences of the
preceding character.

•

Example:
ca?r

matches car and cr, but nothing else.

pgorantla.blogspot.com
Regular Expressions

9. Grouping Regular Expressions.
•

Parentheses (()) instruct QuickTest to treat the contained sequence as a unit, just as
in mathematics and programming languages.

•

Using groups is especially useful for delimiting the argument(s) to an alternation
operator ( | ) or a repetition operator ( * , + , ? , { } ).

10. Matching One of Several Regular Expressions.
•

A vertical line (|) instructs QuickTest to match one of a choice of expressions.

•

For example:
Too|bar causes QuickTest to match either Too or bar.
To(o|b)ar causes QuickTest to match either Tooar or Tobar.

pgorantla.blogspot.com
Regular Expressions

11. Matching the Beginning of a Line.
•

A caret (^) instructs QuickTest to match the expression only at the start of a line, or
after a newline character.

•

Example:
Phone matches Phone within the lines—Phone, my Phone, and Phone list, while
^ Phone matches Phone only in the lines—Phone and Phone Numbers.

12. Matching the End of a Line.
•

A dollar sign ($) instructs QuickTest to match the expression only at the end of a line,
or before a newline character.

•

Example:
Phone$ matches Phone only in the line—my Phone.

pgorantla.blogspot.com
Regular Expressions

13. Matching Any Alphanumeric Character Including the Underscore
•

w instructs QuickTest to match any alphanumeric character and the underscore (AZ, a-z, 0-9, _).

•

Example:
w* causes QuickTest to match zero or more occurrences of the alphanumeric
characters—A-Z, a-z, 0-9, and the underscore (_). It matches xyz, p8aj, or
1_uLeu_4.
w{3} causes QuickTest to match 3 occurrences of the alphanumeric characters A-Z,
a-z, 0-9, and the underscore (_). It matches xy4, c7_, or p_n.

pgorantla.blogspot.com
Regular Expressions

14. Matching Any Non-AlphaNumeric Character
•

W instructs QuickTest to match any character other than alphanumeric characters
and underscores.

•

Example:
W matches &, *, ^, %, $, and #.

15. Combining Regular Expression Operators
•

You can combine regular expression operators in a single expression to achieve the
exact search criteria you need.

•

Example,
start.*

matches start, started, starting, starter, etc.

pgorantla.blogspot.com
Regular Expressions



A SubMatches collection contains individual submatch strings .



Strings following the specified pattern will get stored in submatches collection when
regular expression is executed.



Case Study: Verify the PATTERNS of email-ids.

Problem: Fetch submatch email-ids strings which follows
the following the regular
expression
pattern "w{6}.w{6}@w{9}.w{3}“.

pgorantla.blogspot.com
Solution:











Create a regular expression using New.
Set the pattern using pattern property.
Execute search using Execute Method.
FirstIndex property- It uses a zerobased offset from the beginning of the
search string .
Value property will give exact value at
particular location.
For Each...Next Statement
Used to Repeats a group of statements
for each element in an array or
collection.
Patterns Property- It Sets or returns the
regular expression pattern being
searched for

pgorantla.blogspot.com
Regular Expressions



Used to change value of a property in a predictable way during each run session.



By default, the value of all Property objects added to a Properties collection are treated as
regular expressions.



Use the RegularExpression property to change this setting for a specific Property object in the
collection.



Syntax
PropertiesColl(Property).RegularExpression = BooleanSetting
Argument
Property

Variant

The property for which you want to specify the regular
expression value. Specify the name of the property or its
position in the collection.

BooleanSetting



Type

Description

Boolean

The new value for the specified property.

Example
The following example uses the RegularExpression property to set the value of the PropName Property
object as a literal value.
set MyDesc = Description.Create()
MyDesc("PropName").Value = PropValue
MyDesc("PropName").RegularExpression = FALSE
pgorantla.blogspot.com
Regular Expressions



We can set a new value for an existing Property object in the properties collection, or adds a new property
object if the specified property name does not exist in the Properties collection.



For Example : If we want to change the name of userName WebEdit control to LoginName then following
code should be added.

pgorantla.blogspot.com
Regular Expressions



Case Study
•

Problem: Consider a site includes a form in which the user inputs data
and clicks the Send button to submit the form.

•

When a required field is not completed, the form is displayed again
for the user to complete.

•

When resubmitting the form, the user clicks the Resend button.

•

Solution: Define the value of the button's name property as a regular
expression, so that QuickTest ignores variations in the button name
when clicking the button.

pgorantla.blogspot.com
Regular Expressions



Set the expected value of an object's property as a regular expression so
that an object with a varying value can be verified.



When creating a text checkpoint to check that a varying text string is
displayed on your Web site or application, you can define the text string
as a regular expression.



Case
Study
Problem : Check that every window and dialog box in the application
contains the name of the application followed by a hyphen (-) and a
descriptive title.
Solution : Add a checkpoint to each dialog box object in the test to check
that the first part of the title contains the name of the application followed
by a hyphen. .
pgorantla.blogspot.com
Regular Expressions

•

Problem:

•

Create a text checkpoint on a date text string that changes according to the selected flight
date.

•

Solution:
Define the date as a regular expression so that the checkpoint checks that the captured
text string matches the expected format, rather than checking the exact text.
In the Active Screen, scroll up and highlight the date. Right-click the highlighted string and
select Insert Text Checkpoint. The Text Checkpoint Properties dialog box opens.
Replace the current date with [0-1][0-9]/[0-3][0-9]/200[0-9].
This instructs QuickTest to check that each character in the selected text matches the
number-range format defined by the regular expression.

pgorantla.blogspot.com
Regular Expressions



Running and Analyzing a Test with Regular
Expressions



Examine the checkpoint results.



The checkpoint passed because the text was displayed in the format
specified by the regular expression
pgorantla.blogspot.com
•

Problem: Consider a site includes a form in which the user inputs data
and clicks the Send button to submit the form.
 When a required field is not completed, the form is displayed again for the

user to complete.
 When resubmitting the form, the user clicks the Resend button.
•

Solution: Define the value of the button's name property as a regular
expression, so that QuickTest ignores variations in the button name
when clicking the button.

pgorantla.blogspot.com
Regular Expressions

Q & A….

pgorantla.blogspot.com
Regular Expressions



Regular expressions enable QuickTest to identify
objects and text strings with varying values.



We can use regular expressions when:
 Defining the property values of an object in dialog boxes or in
programmatic descriptions
 Parameterizing a step
 Creating checkpoints with varying values



Use the RegularExpression property to change this
setting for a specific Property object in the collection.

pgorantla.blogspot.com

Mais conteúdo relacionado

Mais procurados

Regular expression
Regular expressionRegular expression
Regular expressionLarry Nung
 
Regular Expressions and You
Regular Expressions and YouRegular Expressions and You
Regular Expressions and YouJames Armes
 
Bioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introductionBioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introductionProf. Wim Van Criekinge
 
Regular expressions in oracle
Regular expressions in oracleRegular expressions in oracle
Regular expressions in oracleLogan Palanisamy
 
The Power of Regular Expression: use in notepad++
The Power of Regular Expression: use in notepad++The Power of Regular Expression: use in notepad++
The Power of Regular Expression: use in notepad++Anjesh Tuladhar
 
Introduction to regular expressions
Introduction to regular expressionsIntroduction to regular expressions
Introduction to regular expressionsBen Brumfield
 
Maxbox starter20
Maxbox starter20Maxbox starter20
Maxbox starter20Max Kleiner
 
Regular Expressions 101 Introduction to Regular Expressions
Regular Expressions 101 Introduction to Regular ExpressionsRegular Expressions 101 Introduction to Regular Expressions
Regular Expressions 101 Introduction to Regular ExpressionsDanny Bryant
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsRaj Gupta
 
Chapter Two(1)
Chapter Two(1)Chapter Two(1)
Chapter Two(1)bolovv
 
Applying Generics
Applying GenericsApplying Generics
Applying GenericsBharat17485
 
Chapter Three(2)
Chapter Three(2)Chapter Three(2)
Chapter Three(2)bolovv
 

Mais procurados (20)

Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 
Regular expression
Regular expressionRegular expression
Regular expression
 
Regular Expressions and You
Regular Expressions and YouRegular Expressions and You
Regular Expressions and You
 
Bioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introductionBioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introduction
 
Regular expressions in oracle
Regular expressions in oracleRegular expressions in oracle
Regular expressions in oracle
 
Regex lecture
Regex lectureRegex lecture
Regex lecture
 
LISP: Type specifiers in lisp
LISP: Type specifiers in lispLISP: Type specifiers in lisp
LISP: Type specifiers in lisp
 
The Power of Regular Expression: use in notepad++
The Power of Regular Expression: use in notepad++The Power of Regular Expression: use in notepad++
The Power of Regular Expression: use in notepad++
 
Introduction to regular expressions
Introduction to regular expressionsIntroduction to regular expressions
Introduction to regular expressions
 
Maxbox starter20
Maxbox starter20Maxbox starter20
Maxbox starter20
 
Python data handling
Python data handlingPython data handling
Python data handling
 
Regular Expressions 101 Introduction to Regular Expressions
Regular Expressions 101 Introduction to Regular ExpressionsRegular Expressions 101 Introduction to Regular Expressions
Regular Expressions 101 Introduction to Regular Expressions
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Chapter Two(1)
Chapter Two(1)Chapter Two(1)
Chapter Two(1)
 
Applying Generics
Applying GenericsApplying Generics
Applying Generics
 
Regex Basics
Regex BasicsRegex Basics
Regex Basics
 
PHP Regular Expressions
PHP Regular ExpressionsPHP Regular Expressions
PHP Regular Expressions
 
Chapter Three(2)
Chapter Three(2)Chapter Three(2)
Chapter Three(2)
 
LISP: Data types in lisp
LISP: Data types in lispLISP: Data types in lisp
LISP: Data types in lisp
 
Spsl II unit
Spsl   II unitSpsl   II unit
Spsl II unit
 

Semelhante a 2.regular expressions

Regular expressions
Regular expressionsRegular expressions
Regular expressionsRaghu nath
 
Python - Regular Expressions
Python - Regular ExpressionsPython - Regular Expressions
Python - Regular ExpressionsMukesh Tekwani
 
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 JavaScript - Chapter 9 - TypeConversion and Regular Expressions  JavaScript - Chapter 9 - TypeConversion and Regular Expressions
JavaScript - Chapter 9 - TypeConversion and Regular Expressions WebStackAcademy
 
Introduction to Boost regex
Introduction to Boost regexIntroduction to Boost regex
Introduction to Boost regexYongqiang Li
 
Csharp4 strings and_regular_expressions
Csharp4 strings and_regular_expressionsCsharp4 strings and_regular_expressions
Csharp4 strings and_regular_expressionsAbed Bukhari
 
Java: Regular Expression
Java: Regular ExpressionJava: Regular Expression
Java: Regular ExpressionMasudul Haque
 
Java căn bản - Chapter9
Java căn bản - Chapter9Java căn bản - Chapter9
Java căn bản - Chapter9Vince Vo
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and StringsEduardo Bergavera
 
Regular expressions in Python
Regular expressions in PythonRegular expressions in Python
Regular expressions in PythonSujith Kumar
 
Python Programming Basics for begginners
Python Programming Basics for begginnersPython Programming Basics for begginners
Python Programming Basics for begginnersAbishek Purushothaman
 
Don't Fear the Regex LSP15
Don't Fear the Regex LSP15Don't Fear the Regex LSP15
Don't Fear the Regex LSP15Sandy Smith
 
Chapter 3: Introduction to Regular Expression
Chapter 3: Introduction to Regular ExpressionChapter 3: Introduction to Regular Expression
Chapter 3: Introduction to Regular Expressionazzamhadeel89
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basicsrobertbenard
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basicsrobertbenard
 
9781305078444 ppt ch08
9781305078444 ppt ch089781305078444 ppt ch08
9781305078444 ppt ch08Terry Yoast
 
Pattern Matching - at a glance
Pattern Matching - at a glancePattern Matching - at a glance
Pattern Matching - at a glanceKnoldus Inc.
 

Semelhante a 2.regular expressions (20)

Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Python - Regular Expressions
Python - Regular ExpressionsPython - Regular Expressions
Python - Regular Expressions
 
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 JavaScript - Chapter 9 - TypeConversion and Regular Expressions  JavaScript - Chapter 9 - TypeConversion and Regular Expressions
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 
Introduction to Boost regex
Introduction to Boost regexIntroduction to Boost regex
Introduction to Boost regex
 
Csharp4 strings and_regular_expressions
Csharp4 strings and_regular_expressionsCsharp4 strings and_regular_expressions
Csharp4 strings and_regular_expressions
 
Java: Regular Expression
Java: Regular ExpressionJava: Regular Expression
Java: Regular Expression
 
Java căn bản - Chapter9
Java căn bản - Chapter9Java căn bản - Chapter9
Java căn bản - Chapter9
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and Strings
 
Regular expressions in Python
Regular expressions in PythonRegular expressions in Python
Regular expressions in Python
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
Bioinformatica p2-p3-introduction
Bioinformatica p2-p3-introductionBioinformatica p2-p3-introduction
Bioinformatica p2-p3-introduction
 
Python Programming Basics for begginners
Python Programming Basics for begginnersPython Programming Basics for begginners
Python Programming Basics for begginners
 
2013 - Andrei Zmievski: Clínica Regex
2013 - Andrei Zmievski: Clínica Regex2013 - Andrei Zmievski: Clínica Regex
2013 - Andrei Zmievski: Clínica Regex
 
Don't Fear the Regex LSP15
Don't Fear the Regex LSP15Don't Fear the Regex LSP15
Don't Fear the Regex LSP15
 
Chapter 3: Introduction to Regular Expression
Chapter 3: Introduction to Regular ExpressionChapter 3: Introduction to Regular Expression
Chapter 3: Introduction to Regular Expression
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basics
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basics
 
C# String
C# StringC# String
C# String
 
9781305078444 ppt ch08
9781305078444 ppt ch089781305078444 ppt ch08
9781305078444 ppt ch08
 
Pattern Matching - at a glance
Pattern Matching - at a glancePattern Matching - at a glance
Pattern Matching - at a glance
 

Mais de Praveen Gorantla (13)

Troubleshooting with QTP
Troubleshooting with QTPTroubleshooting with QTP
Troubleshooting with QTP
 
File System Object in QTP
File System Object in QTPFile System Object in QTP
File System Object in QTP
 
Recovery Scenario in QTP
Recovery Scenario in QTPRecovery Scenario in QTP
Recovery Scenario in QTP
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
 
QTP Functions
QTP FunctionsQTP Functions
QTP Functions
 
VB Script Overview
VB Script OverviewVB Script Overview
VB Script Overview
 
Regular Expressions in QTP
Regular Expressions in QTPRegular Expressions in QTP
Regular Expressions in QTP
 
Dynamic Content in QTP
Dynamic Content in QTPDynamic Content in QTP
Dynamic Content in QTP
 
Business Process Testing
Business Process TestingBusiness Process Testing
Business Process Testing
 
QTP Basics-2
QTP Basics-2QTP Basics-2
QTP Basics-2
 
QTP with QualityCenter
QTP with  QualityCenterQTP with  QualityCenter
QTP with QualityCenter
 
Virtual objects
Virtual objectsVirtual objects
Virtual objects
 
1.qtp basics
1.qtp basics1.qtp basics
1.qtp basics
 

Último

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 

Último (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

2.regular expressions

  • 1.
  • 2. Regular Expressions  What is Regular Expressions ?  Common Scenarios where Regular Expressions are used  Regular Expression submatch String  Using Regular Expressions for Property Values  Using Regular Expressions in Checkpoints  Case Study  Session Wrap-Up pgorantla.blogspot.com
  • 3. Regular Expressions  A regular expression is a string that describes or matches a set of strings, according to certain syntax rules. or A regular expression, often called a pattern, is an expression that describes a set of strings. They are usually used to give a concise description of a set, without having to list all elements.  Regular expressions are used by many text editors and utilities to search and manipulate bodies of text based on certain patterns.  Many programming languages support regular expressions for string manipulation. For example, Perl has a powerful regular expression engine built directly into its syntax.  The set of utilities (including the editor sed and the filter grep) provided by Unix distributions were the first to popularize the concept of regular expressions.  The origin of regular expressions lies in Automata Theory and formal language theory (both part of Theoretical Computer Science.  Can use regular expressions for : - Defining the property values of an object in dialog boxes. - Parameterizing a step. - Creating checkpoints with varying values. pgorantla.blogspot.com
  • 4. Regular Expressions 1. Using the Backslash Character  A backslash () instructs QuickTest to treat the next character as a literal character, if it is otherwise a special character .  The backslash () can also instruct QuickTest to recognize certain ordinary characters as special characters. Example: QuickTest recognizes n as the special newline character.  Example:    matches the literal character ( matches the literal character ( Scenario: If you are looking for a Web site called: mercurytours.mercuryinteractive.com the period would be mistaken as an indication of a regular expression. • To indicate that the period is not part of a regular expression, you would enter it as follows: mercurytours.mercuryinteractive.com pgorantla.blogspot.com
  • 5. Regular Expressions 2. Matching Any Single Character  A period (.) instructs QuickTest to search for any single character (except for n). For example: Welcome. matches Welcomes, Welcomed, or Welcome followed by a space or any other single character.  A series of periods indicates the same number of unspecified characters.  To match any single character including n, enter: (.|n) pgorantla.blogspot.com
  • 6. Regular Expressions 3. Matching Any Single Character in a List • Square brackets instruct QuickTest to search for any single character within a list of characters. • Example, to search for the date 2000, 2001, or 2002, enter: 200[012] 4. Matching Any Single Character Not in a List Iterative constructs. • When a caret (^) is the first character inside square brackets, it instructs QuickTest to match any character in the list except for the ones specified in the string. • Example: [^ab] matches any character except a or b. Note: The caret has this special meaning only when it is displayed first within the brackets. pgorantla.blogspot.com
  • 7. Regular Expressions 5. Matching Any Single Character within a Range. • In order to match a single character within a range, you can use square brackets ([ ]) with the hyphen (-) character. • Example : To match any year in the 2000s, enter: 200[0-9] 6. Matching Zero or More Specific Characters Functions and subroutines. • • An asterisk (*) instructs QuickTest to match zero or more occurrences of the preceding character. For example: ca*r matches car, caaaaaar, and cr. pgorantla.blogspot.com
  • 8. Regular Expressions 7. Matching One or More Specific Characters. • A plus sign (+) instructs QuickTest to match one or more occurrences of the preceding character. • Example: ca+r matches car and caaaaaar, but not cr. 8. Matching Zero or One Specific Character. • A question mark (?) instructs QuickTest to match zero or one occurrences of the preceding character. • Example: ca?r matches car and cr, but nothing else. pgorantla.blogspot.com
  • 9. Regular Expressions 9. Grouping Regular Expressions. • Parentheses (()) instruct QuickTest to treat the contained sequence as a unit, just as in mathematics and programming languages. • Using groups is especially useful for delimiting the argument(s) to an alternation operator ( | ) or a repetition operator ( * , + , ? , { } ). 10. Matching One of Several Regular Expressions. • A vertical line (|) instructs QuickTest to match one of a choice of expressions. • For example: Too|bar causes QuickTest to match either Too or bar. To(o|b)ar causes QuickTest to match either Tooar or Tobar. pgorantla.blogspot.com
  • 10. Regular Expressions 11. Matching the Beginning of a Line. • A caret (^) instructs QuickTest to match the expression only at the start of a line, or after a newline character. • Example: Phone matches Phone within the lines—Phone, my Phone, and Phone list, while ^ Phone matches Phone only in the lines—Phone and Phone Numbers. 12. Matching the End of a Line. • A dollar sign ($) instructs QuickTest to match the expression only at the end of a line, or before a newline character. • Example: Phone$ matches Phone only in the line—my Phone. pgorantla.blogspot.com
  • 11. Regular Expressions 13. Matching Any Alphanumeric Character Including the Underscore • w instructs QuickTest to match any alphanumeric character and the underscore (AZ, a-z, 0-9, _). • Example: w* causes QuickTest to match zero or more occurrences of the alphanumeric characters—A-Z, a-z, 0-9, and the underscore (_). It matches xyz, p8aj, or 1_uLeu_4. w{3} causes QuickTest to match 3 occurrences of the alphanumeric characters A-Z, a-z, 0-9, and the underscore (_). It matches xy4, c7_, or p_n. pgorantla.blogspot.com
  • 12. Regular Expressions 14. Matching Any Non-AlphaNumeric Character • W instructs QuickTest to match any character other than alphanumeric characters and underscores. • Example: W matches &, *, ^, %, $, and #. 15. Combining Regular Expression Operators • You can combine regular expression operators in a single expression to achieve the exact search criteria you need. • Example, start.* matches start, started, starting, starter, etc. pgorantla.blogspot.com
  • 13. Regular Expressions  A SubMatches collection contains individual submatch strings .  Strings following the specified pattern will get stored in submatches collection when regular expression is executed.  Case Study: Verify the PATTERNS of email-ids. Problem: Fetch submatch email-ids strings which follows the following the regular expression pattern "w{6}.w{6}@w{9}.w{3}“. pgorantla.blogspot.com
  • 14. Solution:        Create a regular expression using New. Set the pattern using pattern property. Execute search using Execute Method. FirstIndex property- It uses a zerobased offset from the beginning of the search string . Value property will give exact value at particular location. For Each...Next Statement Used to Repeats a group of statements for each element in an array or collection. Patterns Property- It Sets or returns the regular expression pattern being searched for pgorantla.blogspot.com
  • 15. Regular Expressions  Used to change value of a property in a predictable way during each run session.  By default, the value of all Property objects added to a Properties collection are treated as regular expressions.  Use the RegularExpression property to change this setting for a specific Property object in the collection.  Syntax PropertiesColl(Property).RegularExpression = BooleanSetting Argument Property Variant The property for which you want to specify the regular expression value. Specify the name of the property or its position in the collection. BooleanSetting  Type Description Boolean The new value for the specified property. Example The following example uses the RegularExpression property to set the value of the PropName Property object as a literal value. set MyDesc = Description.Create() MyDesc("PropName").Value = PropValue MyDesc("PropName").RegularExpression = FALSE pgorantla.blogspot.com
  • 16. Regular Expressions  We can set a new value for an existing Property object in the properties collection, or adds a new property object if the specified property name does not exist in the Properties collection.  For Example : If we want to change the name of userName WebEdit control to LoginName then following code should be added. pgorantla.blogspot.com
  • 17. Regular Expressions  Case Study • Problem: Consider a site includes a form in which the user inputs data and clicks the Send button to submit the form. • When a required field is not completed, the form is displayed again for the user to complete. • When resubmitting the form, the user clicks the Resend button. • Solution: Define the value of the button's name property as a regular expression, so that QuickTest ignores variations in the button name when clicking the button. pgorantla.blogspot.com
  • 18. Regular Expressions  Set the expected value of an object's property as a regular expression so that an object with a varying value can be verified.  When creating a text checkpoint to check that a varying text string is displayed on your Web site or application, you can define the text string as a regular expression.  Case Study Problem : Check that every window and dialog box in the application contains the name of the application followed by a hyphen (-) and a descriptive title. Solution : Add a checkpoint to each dialog box object in the test to check that the first part of the title contains the name of the application followed by a hyphen. . pgorantla.blogspot.com
  • 19. Regular Expressions • Problem: • Create a text checkpoint on a date text string that changes according to the selected flight date. • Solution: Define the date as a regular expression so that the checkpoint checks that the captured text string matches the expected format, rather than checking the exact text. In the Active Screen, scroll up and highlight the date. Right-click the highlighted string and select Insert Text Checkpoint. The Text Checkpoint Properties dialog box opens. Replace the current date with [0-1][0-9]/[0-3][0-9]/200[0-9]. This instructs QuickTest to check that each character in the selected text matches the number-range format defined by the regular expression. pgorantla.blogspot.com
  • 20. Regular Expressions  Running and Analyzing a Test with Regular Expressions  Examine the checkpoint results.  The checkpoint passed because the text was displayed in the format specified by the regular expression pgorantla.blogspot.com
  • 21. • Problem: Consider a site includes a form in which the user inputs data and clicks the Send button to submit the form.  When a required field is not completed, the form is displayed again for the user to complete.  When resubmitting the form, the user clicks the Resend button. • Solution: Define the value of the button's name property as a regular expression, so that QuickTest ignores variations in the button name when clicking the button. pgorantla.blogspot.com
  • 22. Regular Expressions Q & A…. pgorantla.blogspot.com
  • 23. Regular Expressions  Regular expressions enable QuickTest to identify objects and text strings with varying values.  We can use regular expressions when:  Defining the property values of an object in dialog boxes or in programmatic descriptions  Parameterizing a step  Creating checkpoints with varying values  Use the RegularExpression property to change this setting for a specific Property object in the collection. pgorantla.blogspot.com

Notas do Editor

  1. Briefly review the session agenda as indicated here. Currently we are in the “Prep Session Introduction” section, during which we will review basic information about this session, including how to use Centra to participate. Note: The Prep Session Introduction section should take no longer than 15 minutes.
  2. Steps: In the Active Screen, scroll up and highlight the date. Right-click the highlighted string and select Insert Text Checkpoint. The Text Checkpoint Properties dialog box opens.
  3. Spend a few moments answering participants’ questions about the agenda of this session or the Centra controls they will be using. Remind them to use the “Raise Hand” icon to ask a question.