SlideShare a Scribd company logo
1 of 16
Download to read offline
Regular Expressions
… and Their Place in the QA Engineer's Life
Svetlin Nakov
Manager Training
and Inspiration
Software University
http://softuni.bg
What are Regular Expressions?
• Regular expressions (regex)
– Match text by pattern
• Patterns are defined by special syntax, e.g.
– [0-9]+ matches non-empty sequence of digits
– [A-Z][a-z]* matches a capital + small letters
– s+ matches whitespace (non-empty)
• S+ matches non-whitespace
2
3
DEMO
www.regexr.com
More Patterns
• d+ matches digits
– D+ matches non-digits
• w+ matches letters (Unicode)
– W+ matches non-letters
• +d{1,3}([ -]*[0-9]){6,} matches
international phone, e.g. +359 2 123-456
4
5
DEMO
www.regexr.com
Validation by Regex
• ^ matches start of text
• $ matches end of text
• ^+d{1,3}([ -]*[0-9]){6,}$ validates
international phone
• +359 2 123-456 is a valid phone
• +359 (888) 123-456 is a invalid phone
6
7
DEMO
www.regexr.com
Regex Literals
• The classical (Perl syntax) is:
– /<regex>/<options>
• Examples:
– /[a-z]+/gi matches all non-empty sequences
of Latin letters, case-insensitively
– /[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,20}/gi
matches emails (simplified pattern)
8
9
DEMO
www.debuggex.com
Some JS Code: Validation
var emailPattern =
/^[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,20}$/i;
console.log(emailPattern.test("test@abv.bg"));
console.log(emailPattern.test("a.hills@gtx.de"));
console.log(emailPattern.test("invalid@@mail"));
console.log(emailPattern.test("err test@abv.bg"));
10
Some JS Code: Split
var towns = "Sofia, Varna,Pleven, Veliko Tarnovo;
Paris – London––Vienann Пловдив|Каспичан";
console.log(towns.split(/W+/)); // incorrect
console.log(towns.split(/s*[.,|;nt–]+s*/));
11
Some JS Code: Match
var text = "I was born at 14-Jun-1980. Today is
14-Mar-2015. Next year starts at 1-Jan-2016 and
ends at 31-Dec-2016.";
var dateRegex = /d{1,2}-w{3}-d{4}/gm;
console.log(text.match(dateRegex));
12
Regex for QA Engineers
• Why should a QA understand regex?
– Validation  prepare regex for developers
– Write automation testing scripts
• E.g. find a text on the page by regex
– Parse a text, extract info, split data, …
13
Resources
• Play with regex:
– http://www.regexr.com
– https://regex101.com
• Visual regex debugger:
– https://www.debuggex.com
• Regex explained (in Bulgarian)
– http://goo.gl/NbBIPe
–
14
Resources (2)
• Interactive Regex Tutorial
– http://regexone.com
• Regex @ W3Schools
– http://w3schools.com/jsref/jsref_obj_regexp.asp
• Regex Tutorial (for Java)
– vogella.com/tutorials/JavaRegularExpressions/article.html
15
Regular Expressions
Questions?
16

More Related Content

Viewers also liked

Slavy Slavov - 6 Common Challenges Setting Up Selenium in High Scale
Slavy Slavov - 6 Common Challenges Setting Up Selenium in High ScaleSlavy Slavov - 6 Common Challenges Setting Up Selenium in High Scale
Slavy Slavov - 6 Common Challenges Setting Up Selenium in High ScalePeter Sabev
 
Veselin Berov - Testing in the World of Information Management
Veselin Berov - Testing in the World of Information ManagementVeselin Berov - Testing in the World of Information Management
Veselin Berov - Testing in the World of Information ManagementPeter Sabev
 
Професия QA инженер - SoftUniConf June 2015
Професия QA инженер - SoftUniConf June 2015Професия QA инженер - SoftUniConf June 2015
Професия QA инженер - SoftUniConf June 2015Peter Sabev
 
SUE AGILE MVVM (Italian)
SUE AGILE MVVM (Italian)SUE AGILE MVVM (Italian)
SUE AGILE MVVM (Italian)Sabino Labarile
 
Nakov at Fuck Up Nights - July 2015 @ Sofia
Nakov at Fuck Up Nights - July 2015 @ SofiaNakov at Fuck Up Nights - July 2015 @ Sofia
Nakov at Fuck Up Nights - July 2015 @ SofiaSvetlin Nakov
 
Slide typescript - xe dotnet - Codemotion Rome 2015
Slide typescript - xe dotnet - Codemotion Rome 2015Slide typescript - xe dotnet - Codemotion Rome 2015
Slide typescript - xe dotnet - Codemotion Rome 2015Codemotion
 
Следвай вдъхновението си! (фестивал "Свободата да бъдеш - април 2016")
Следвай вдъхновението си! (фестивал "Свободата да бъдеш - април 2016")Следвай вдъхновението си! (фестивал "Свободата да бъдеш - април 2016")
Следвай вдъхновението си! (фестивал "Свободата да бъдеш - април 2016")Svetlin Nakov
 
Introduzione a MVVM e Caliburn.Micro
Introduzione a MVVM e Caliburn.MicroIntroduzione a MVVM e Caliburn.Micro
Introduzione a MVVM e Caliburn.MicroMassimo Bonanni
 
Slide Prelaurea. Alessandro Andreosè
Slide Prelaurea. Alessandro AndreosèSlide Prelaurea. Alessandro Andreosè
Slide Prelaurea. Alessandro Andreosèguesta10af3
 
Професия "програмист"
Професия "програмист"Професия "програмист"
Професия "програмист"Svetlin Nakov
 
Dependency Injection and Inversion Of Control
Dependency Injection and Inversion Of ControlDependency Injection and Inversion Of Control
Dependency Injection and Inversion Of ControlSimone Busoli
 
Inversion of Control @ CD2008
Inversion of Control @ CD2008Inversion of Control @ CD2008
Inversion of Control @ CD2008Mauro Servienti
 
Как да станем софтуерни инженери и да стартираме ИТ бизнес?
Как да станем софтуерни инженери и да стартираме ИТ бизнес?Как да станем софтуерни инженери и да стартираме ИТ бизнес?
Как да станем софтуерни инженери и да стартираме ИТ бизнес?Svetlin Nakov
 
Model-View-ViewModel
Model-View-ViewModelModel-View-ViewModel
Model-View-ViewModelDotNetMarche
 
Работа с Естествен Интелект – Личност – Време – 3 юли 2013 @ НЛП клуб
Работа с Естествен Интелект – Личност – Време – 3 юли 2013 @ НЛП клубРабота с Естествен Интелект – Личност – Време – 3 юли 2013 @ НЛП клуб
Работа с Естествен Интелект – Личност – Време – 3 юли 2013 @ НЛП клубSvetlin Nakov
 
Architetttura Della Soluzione
Architetttura Della SoluzioneArchitetttura Della Soluzione
Architetttura Della SoluzioneLuca Milan
 

Viewers also liked (20)

Slavy Slavov - 6 Common Challenges Setting Up Selenium in High Scale
Slavy Slavov - 6 Common Challenges Setting Up Selenium in High ScaleSlavy Slavov - 6 Common Challenges Setting Up Selenium in High Scale
Slavy Slavov - 6 Common Challenges Setting Up Selenium in High Scale
 
Veselin Berov - Testing in the World of Information Management
Veselin Berov - Testing in the World of Information ManagementVeselin Berov - Testing in the World of Information Management
Veselin Berov - Testing in the World of Information Management
 
Професия QA инженер - SoftUniConf June 2015
Професия QA инженер - SoftUniConf June 2015Професия QA инженер - SoftUniConf June 2015
Професия QA инженер - SoftUniConf June 2015
 
System.AddIn @ Xe.Net
System.AddIn @ Xe.NetSystem.AddIn @ Xe.Net
System.AddIn @ Xe.Net
 
SUE AGILE MVVM (Italian)
SUE AGILE MVVM (Italian)SUE AGILE MVVM (Italian)
SUE AGILE MVVM (Italian)
 
Nakov at Fuck Up Nights - July 2015 @ Sofia
Nakov at Fuck Up Nights - July 2015 @ SofiaNakov at Fuck Up Nights - July 2015 @ Sofia
Nakov at Fuck Up Nights - July 2015 @ Sofia
 
Slide typescript - xe dotnet - Codemotion Rome 2015
Slide typescript - xe dotnet - Codemotion Rome 2015Slide typescript - xe dotnet - Codemotion Rome 2015
Slide typescript - xe dotnet - Codemotion Rome 2015
 
Следвай вдъхновението си! (фестивал "Свободата да бъдеш - април 2016")
Следвай вдъхновението си! (фестивал "Свободата да бъдеш - април 2016")Следвай вдъхновението си! (фестивал "Свободата да бъдеш - април 2016")
Следвай вдъхновението си! (фестивал "Свободата да бъдеш - април 2016")
 
Introduzione a MVVM e Caliburn.Micro
Introduzione a MVVM e Caliburn.MicroIntroduzione a MVVM e Caliburn.Micro
Introduzione a MVVM e Caliburn.Micro
 
Slide Prelaurea. Alessandro Andreosè
Slide Prelaurea. Alessandro AndreosèSlide Prelaurea. Alessandro Andreosè
Slide Prelaurea. Alessandro Andreosè
 
Професия "програмист"
Професия "програмист"Професия "програмист"
Професия "програмист"
 
Dependency Injection and Inversion Of Control
Dependency Injection and Inversion Of ControlDependency Injection and Inversion Of Control
Dependency Injection and Inversion Of Control
 
Inversion of Control @ CD2008
Inversion of Control @ CD2008Inversion of Control @ CD2008
Inversion of Control @ CD2008
 
Как да станем софтуерни инженери и да стартираме ИТ бизнес?
Как да станем софтуерни инженери и да стартираме ИТ бизнес?Как да станем софтуерни инженери и да стартираме ИТ бизнес?
Как да станем софтуерни инженери и да стартираме ИТ бизнес?
 
Model-View-ViewModel
Model-View-ViewModelModel-View-ViewModel
Model-View-ViewModel
 
Работа с Естествен Интелект – Личност – Време – 3 юли 2013 @ НЛП клуб
Работа с Естествен Интелект – Личност – Време – 3 юли 2013 @ НЛП клубРабота с Естествен Интелект – Личност – Време – 3 юли 2013 @ НЛП клуб
Работа с Естествен Интелект – Личност – Време – 3 юли 2013 @ НЛП клуб
 
Architetttura Della Soluzione
Architetttura Della SoluzioneArchitetttura Della Soluzione
Architetttura Della Soluzione
 
UI Composition
UI CompositionUI Composition
UI Composition
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Introduzione WPF
Introduzione WPFIntroduzione WPF
Introduzione WPF
 

Similar to Regular Expressions: QA Challenge Accepted Conf (March 2015)

Regular expressions
Regular expressionsRegular expressions
Regular expressionsEran Zimbler
 
Week-2: Theory & Practice of Data Cleaning: Regular Expressions in Practice
Week-2: Theory & Practice of Data Cleaning: Regular Expressions in PracticeWeek-2: Theory & Practice of Data Cleaning: Regular Expressions in Practice
Week-2: Theory & Practice of Data Cleaning: Regular Expressions in PracticeBertram Ludäscher
 
Regular Expressions and You
Regular Expressions and YouRegular Expressions and You
Regular Expressions and YouJames Armes
 
regex_presentation.pptx
regex_presentation.pptxregex_presentation.pptx
regex_presentation.pptxBeBetter4
 
MarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A Primer
MarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A PrimerMarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A Primer
MarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A PrimerTerry Reese
 
OISF: Regular Expressions (Regex) Overview
OISF: Regular Expressions (Regex) OverviewOISF: Regular Expressions (Regex) Overview
OISF: Regular Expressions (Regex) OverviewCiNPA Security SIG
 
Regular Expressions 2007
Regular Expressions 2007Regular Expressions 2007
Regular Expressions 2007Geoffrey Dunn
 
DerbyCon 7.0 Legacy: Regular Expressions (Regex) Overview
DerbyCon 7.0 Legacy: Regular Expressions (Regex) OverviewDerbyCon 7.0 Legacy: Regular Expressions (Regex) Overview
DerbyCon 7.0 Legacy: Regular Expressions (Regex) OverviewCiNPA Security SIG
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsssuser8779cd
 
Regular Expression in Action
Regular Expression in ActionRegular Expression in Action
Regular Expression in ActionFolio3 Software
 
Regular Expressions Boot Camp
Regular Expressions Boot CampRegular Expressions Boot Camp
Regular Expressions Boot CampChris Schiffhauer
 
How to check valid Email? Find using regex.
How to check valid Email? Find using regex.How to check valid Email? Find using regex.
How to check valid Email? Find using regex.Poznań Ruby User Group
 
Modules 17 12_2020
Modules 17 12_2020Modules 17 12_2020
Modules 17 12_2020Sugnan M
 
Bioinformatics p2-p3-perl-regexes v2013-wim_vancriekinge
Bioinformatics p2-p3-perl-regexes v2013-wim_vancriekingeBioinformatics p2-p3-perl-regexes v2013-wim_vancriekinge
Bioinformatics p2-p3-perl-regexes v2013-wim_vancriekingeProf. Wim Van Criekinge
 

Similar to Regular Expressions: QA Challenge Accepted Conf (March 2015) (20)

Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Week-2: Theory & Practice of Data Cleaning: Regular Expressions in Practice
Week-2: Theory & Practice of Data Cleaning: Regular Expressions in PracticeWeek-2: Theory & Practice of Data Cleaning: Regular Expressions in Practice
Week-2: Theory & Practice of Data Cleaning: Regular Expressions in Practice
 
Regular expression for everyone
Regular expression for everyoneRegular expression for everyone
Regular expression for everyone
 
Regular Expressions and You
Regular Expressions and YouRegular Expressions and You
Regular Expressions and You
 
regex_presentation.pptx
regex_presentation.pptxregex_presentation.pptx
regex_presentation.pptx
 
MarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A Primer
MarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A PrimerMarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A Primer
MarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A Primer
 
OISF: Regular Expressions (Regex) Overview
OISF: Regular Expressions (Regex) OverviewOISF: Regular Expressions (Regex) Overview
OISF: Regular Expressions (Regex) Overview
 
Regular Expressions 2007
Regular Expressions 2007Regular Expressions 2007
Regular Expressions 2007
 
DerbyCon 7.0 Legacy: Regular Expressions (Regex) Overview
DerbyCon 7.0 Legacy: Regular Expressions (Regex) OverviewDerbyCon 7.0 Legacy: Regular Expressions (Regex) Overview
DerbyCon 7.0 Legacy: Regular Expressions (Regex) Overview
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Regular Expression in Action
Regular Expression in ActionRegular Expression in Action
Regular Expression in Action
 
Regular Expressions Boot Camp
Regular Expressions Boot CampRegular Expressions Boot Camp
Regular Expressions Boot Camp
 
How to check valid Email? Find using regex.
How to check valid Email? Find using regex.How to check valid Email? Find using regex.
How to check valid Email? Find using regex.
 
Modules 17 12_2020
Modules 17 12_2020Modules 17 12_2020
Modules 17 12_2020
 
Lecture 10.pdf
Lecture 10.pdfLecture 10.pdf
Lecture 10.pdf
 
Bioinformatics p2-p3-perl-regexes v2013-wim_vancriekinge
Bioinformatics p2-p3-perl-regexes v2013-wim_vancriekingeBioinformatics p2-p3-perl-regexes v2013-wim_vancriekinge
Bioinformatics p2-p3-perl-regexes v2013-wim_vancriekinge
 
22 spam
22 spam22 spam
22 spam
 
Regex intro
Regex introRegex intro
Regex intro
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 

More from Svetlin Nakov

BG-IT-Edu: отворено учебно съдържание за ИТ учители
BG-IT-Edu: отворено учебно съдържание за ИТ учителиBG-IT-Edu: отворено учебно съдържание за ИТ учители
BG-IT-Edu: отворено учебно съдържание за ИТ учителиSvetlin Nakov
 
Programming World in 2024
Programming World in 2024Programming World in 2024
Programming World in 2024Svetlin Nakov
 
AI Tools for Business and Startups
AI Tools for Business and StartupsAI Tools for Business and Startups
AI Tools for Business and StartupsSvetlin Nakov
 
AI Tools for Scientists - Nakov (Oct 2023)
AI Tools for Scientists - Nakov (Oct 2023)AI Tools for Scientists - Nakov (Oct 2023)
AI Tools for Scientists - Nakov (Oct 2023)Svetlin Nakov
 
AI Tools for Entrepreneurs
AI Tools for EntrepreneursAI Tools for Entrepreneurs
AI Tools for EntrepreneursSvetlin Nakov
 
Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023
Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023
Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023Svetlin Nakov
 
AI Tools for Business and Personal Life
AI Tools for Business and Personal LifeAI Tools for Business and Personal Life
AI Tools for Business and Personal LifeSvetlin Nakov
 
Дипломна работа: учебно съдържание по ООП - Светлин Наков
Дипломна работа: учебно съдържание по ООП - Светлин НаковДипломна работа: учебно съдържание по ООП - Светлин Наков
Дипломна работа: учебно съдържание по ООП - Светлин НаковSvetlin Nakov
 
Дипломна работа: учебно съдържание по ООП
Дипломна работа: учебно съдържание по ООПДипломна работа: учебно съдържание по ООП
Дипломна работа: учебно съдържание по ООПSvetlin Nakov
 
Свободно ИТ учебно съдържание за учители по програмиране и ИТ
Свободно ИТ учебно съдържание за учители по програмиране и ИТСвободно ИТ учебно съдържание за учители по програмиране и ИТ
Свободно ИТ учебно съдържание за учители по програмиране и ИТSvetlin Nakov
 
AI and the Professions of the Future
AI and the Professions of the FutureAI and the Professions of the Future
AI and the Professions of the FutureSvetlin Nakov
 
Programming Languages Trends for 2023
Programming Languages Trends for 2023Programming Languages Trends for 2023
Programming Languages Trends for 2023Svetlin Nakov
 
IT Professions and How to Become a Developer
IT Professions and How to Become a DeveloperIT Professions and How to Become a Developer
IT Professions and How to Become a DeveloperSvetlin Nakov
 
GitHub Actions (Nakov at RuseConf, Sept 2022)
GitHub Actions (Nakov at RuseConf, Sept 2022)GitHub Actions (Nakov at RuseConf, Sept 2022)
GitHub Actions (Nakov at RuseConf, Sept 2022)Svetlin Nakov
 
IT Professions and Their Future
IT Professions and Their FutureIT Professions and Their Future
IT Professions and Their FutureSvetlin Nakov
 
How to Become a QA Engineer and Start a Job
How to Become a QA Engineer and Start a JobHow to Become a QA Engineer and Start a Job
How to Become a QA Engineer and Start a JobSvetlin Nakov
 
Призвание и цели: моята рецепта
Призвание и цели: моята рецептаПризвание и цели: моята рецепта
Призвание и цели: моята рецептаSvetlin Nakov
 
What Mongolian IT Industry Can Learn from Bulgaria?
What Mongolian IT Industry Can Learn from Bulgaria?What Mongolian IT Industry Can Learn from Bulgaria?
What Mongolian IT Industry Can Learn from Bulgaria?Svetlin Nakov
 
How to Become a Software Developer - Nakov in Mongolia (Oct 2022)
How to Become a Software Developer - Nakov in Mongolia (Oct 2022)How to Become a Software Developer - Nakov in Mongolia (Oct 2022)
How to Become a Software Developer - Nakov in Mongolia (Oct 2022)Svetlin Nakov
 
Blockchain and DeFi Overview (Nakov, Sept 2021)
Blockchain and DeFi Overview (Nakov, Sept 2021)Blockchain and DeFi Overview (Nakov, Sept 2021)
Blockchain and DeFi Overview (Nakov, Sept 2021)Svetlin Nakov
 

More from Svetlin Nakov (20)

BG-IT-Edu: отворено учебно съдържание за ИТ учители
BG-IT-Edu: отворено учебно съдържание за ИТ учителиBG-IT-Edu: отворено учебно съдържание за ИТ учители
BG-IT-Edu: отворено учебно съдържание за ИТ учители
 
Programming World in 2024
Programming World in 2024Programming World in 2024
Programming World in 2024
 
AI Tools for Business and Startups
AI Tools for Business and StartupsAI Tools for Business and Startups
AI Tools for Business and Startups
 
AI Tools for Scientists - Nakov (Oct 2023)
AI Tools for Scientists - Nakov (Oct 2023)AI Tools for Scientists - Nakov (Oct 2023)
AI Tools for Scientists - Nakov (Oct 2023)
 
AI Tools for Entrepreneurs
AI Tools for EntrepreneursAI Tools for Entrepreneurs
AI Tools for Entrepreneurs
 
Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023
Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023
Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023
 
AI Tools for Business and Personal Life
AI Tools for Business and Personal LifeAI Tools for Business and Personal Life
AI Tools for Business and Personal Life
 
Дипломна работа: учебно съдържание по ООП - Светлин Наков
Дипломна работа: учебно съдържание по ООП - Светлин НаковДипломна работа: учебно съдържание по ООП - Светлин Наков
Дипломна работа: учебно съдържание по ООП - Светлин Наков
 
Дипломна работа: учебно съдържание по ООП
Дипломна работа: учебно съдържание по ООПДипломна работа: учебно съдържание по ООП
Дипломна работа: учебно съдържание по ООП
 
Свободно ИТ учебно съдържание за учители по програмиране и ИТ
Свободно ИТ учебно съдържание за учители по програмиране и ИТСвободно ИТ учебно съдържание за учители по програмиране и ИТ
Свободно ИТ учебно съдържание за учители по програмиране и ИТ
 
AI and the Professions of the Future
AI and the Professions of the FutureAI and the Professions of the Future
AI and the Professions of the Future
 
Programming Languages Trends for 2023
Programming Languages Trends for 2023Programming Languages Trends for 2023
Programming Languages Trends for 2023
 
IT Professions and How to Become a Developer
IT Professions and How to Become a DeveloperIT Professions and How to Become a Developer
IT Professions and How to Become a Developer
 
GitHub Actions (Nakov at RuseConf, Sept 2022)
GitHub Actions (Nakov at RuseConf, Sept 2022)GitHub Actions (Nakov at RuseConf, Sept 2022)
GitHub Actions (Nakov at RuseConf, Sept 2022)
 
IT Professions and Their Future
IT Professions and Their FutureIT Professions and Their Future
IT Professions and Their Future
 
How to Become a QA Engineer and Start a Job
How to Become a QA Engineer and Start a JobHow to Become a QA Engineer and Start a Job
How to Become a QA Engineer and Start a Job
 
Призвание и цели: моята рецепта
Призвание и цели: моята рецептаПризвание и цели: моята рецепта
Призвание и цели: моята рецепта
 
What Mongolian IT Industry Can Learn from Bulgaria?
What Mongolian IT Industry Can Learn from Bulgaria?What Mongolian IT Industry Can Learn from Bulgaria?
What Mongolian IT Industry Can Learn from Bulgaria?
 
How to Become a Software Developer - Nakov in Mongolia (Oct 2022)
How to Become a Software Developer - Nakov in Mongolia (Oct 2022)How to Become a Software Developer - Nakov in Mongolia (Oct 2022)
How to Become a Software Developer - Nakov in Mongolia (Oct 2022)
 
Blockchain and DeFi Overview (Nakov, Sept 2021)
Blockchain and DeFi Overview (Nakov, Sept 2021)Blockchain and DeFi Overview (Nakov, Sept 2021)
Blockchain and DeFi Overview (Nakov, Sept 2021)
 

Recently uploaded

Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 

Recently uploaded (20)

Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 

Regular Expressions: QA Challenge Accepted Conf (March 2015)

  • 1. Regular Expressions … and Their Place in the QA Engineer's Life Svetlin Nakov Manager Training and Inspiration Software University http://softuni.bg
  • 2. What are Regular Expressions? • Regular expressions (regex) – Match text by pattern • Patterns are defined by special syntax, e.g. – [0-9]+ matches non-empty sequence of digits – [A-Z][a-z]* matches a capital + small letters – s+ matches whitespace (non-empty) • S+ matches non-whitespace 2
  • 4. More Patterns • d+ matches digits – D+ matches non-digits • w+ matches letters (Unicode) – W+ matches non-letters • +d{1,3}([ -]*[0-9]){6,} matches international phone, e.g. +359 2 123-456 4
  • 6. Validation by Regex • ^ matches start of text • $ matches end of text • ^+d{1,3}([ -]*[0-9]){6,}$ validates international phone • +359 2 123-456 is a valid phone • +359 (888) 123-456 is a invalid phone 6
  • 8. Regex Literals • The classical (Perl syntax) is: – /<regex>/<options> • Examples: – /[a-z]+/gi matches all non-empty sequences of Latin letters, case-insensitively – /[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,20}/gi matches emails (simplified pattern) 8
  • 10. Some JS Code: Validation var emailPattern = /^[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,20}$/i; console.log(emailPattern.test("test@abv.bg")); console.log(emailPattern.test("a.hills@gtx.de")); console.log(emailPattern.test("invalid@@mail")); console.log(emailPattern.test("err test@abv.bg")); 10
  • 11. Some JS Code: Split var towns = "Sofia, Varna,Pleven, Veliko Tarnovo; Paris – London––Vienann Пловдив|Каспичан"; console.log(towns.split(/W+/)); // incorrect console.log(towns.split(/s*[.,|;nt–]+s*/)); 11
  • 12. Some JS Code: Match var text = "I was born at 14-Jun-1980. Today is 14-Mar-2015. Next year starts at 1-Jan-2016 and ends at 31-Dec-2016."; var dateRegex = /d{1,2}-w{3}-d{4}/gm; console.log(text.match(dateRegex)); 12
  • 13. Regex for QA Engineers • Why should a QA understand regex? – Validation  prepare regex for developers – Write automation testing scripts • E.g. find a text on the page by regex – Parse a text, extract info, split data, … 13
  • 14. Resources • Play with regex: – http://www.regexr.com – https://regex101.com • Visual regex debugger: – https://www.debuggex.com • Regex explained (in Bulgarian) – http://goo.gl/NbBIPe – 14
  • 15. Resources (2) • Interactive Regex Tutorial – http://regexone.com • Regex @ W3Schools – http://w3schools.com/jsref/jsref_obj_regexp.asp • Regex Tutorial (for Java) – vogella.com/tutorials/JavaRegularExpressions/article.html 15