SlideShare a Scribd company logo
1 of 7
TEXT PARSING THE EASY WAY
Regular Expressions
March 7-8, 2015
Copyright © Jeff Hart, 2015
1
J e f f H a r t
V a n i s h i n g C l o u d s , I n c .
Levels of Pain
 Regular expressions by copying
 Leveraging (special) metachars
 Advanced topics
 Environment
 Substitutions
 Automating testing
 Syntax influences
Novice
Apprentice
Journeyman
Master
Copyright © Jeff Hart, 2015
2
Why?
 Language for parsing text
 Spawned Perl
 Native type in JavaScript
 First class (class) in .Net
 Largely independent of host environment
 Line breaks, case sensitivity, etc.
 Replace a ton of .indexOf(), .substring(), .contains() …
var regex = /hello/ig
var regex = new System.Text.RegularExpressions.RegEx(@"hello");
Copyright © Jeff Hart, 2015
3
RegEx on a Page
^ $
?*+ {}

()
|
[<{
.
(anchors) From the beginning to the end
(cardinality) …count on
(backslash) …escaping
(both) …parenthesis
(pipe) …or
(starting) …opening brackets
(period) …and anything in between
Copyright © Jeff Hart, 2015
4
Scanning Method
Search: "The levels of confusion: SNAFU, SUSFU, TARFU and FUBAR"
FU
FU FU FU FU
RegEx:
Copyright © Jeff Hart, 2015
5
RegEx
 Brief, terse, powerful
 Getting to a “journeyman” level takes only a few hours
 Use a REPL tool like PowerShell or sites like:
 http://regexpal.com/
 http://regexhero.net/tester/
 When the only tool you know…
^$ . *+?  () | <{[
Copyright © Jeff Hart, 2015
12
SpeakerRate.com
• Search for “regex” or “socalcodecamp”
• http://speakerrate.com/talks/49311 -socalcodecamp -intro-to-regex
Thank YOU!
Copyright © Jeff Hart, 2015
13

More Related Content

What's hot

Executable specifications for xtext
Executable specifications for xtextExecutable specifications for xtext
Executable specifications for xtext
meysholdt
 
Dual Embedding Space Model (DESM)
Dual Embedding Space Model (DESM)Dual Embedding Space Model (DESM)
Dual Embedding Space Model (DESM)
Bhaskar Mitra
 
5. manuel arcedillo & juanjo arevalillo (hermes) translation memories
5. manuel arcedillo & juanjo arevalillo (hermes) translation memories5. manuel arcedillo & juanjo arevalillo (hermes) translation memories
5. manuel arcedillo & juanjo arevalillo (hermes) translation memories
RIILP
 
GRDDL: A Pictorial Approach
GRDDL: A Pictorial ApproachGRDDL: A Pictorial Approach
GRDDL: A Pictorial Approach
Chimezie Ogbuji
 

What's hot (11)

Knowledge Extraction
Knowledge ExtractionKnowledge Extraction
Knowledge Extraction
 
Executable specifications for xtext
Executable specifications for xtextExecutable specifications for xtext
Executable specifications for xtext
 
Andy On Closures
Andy On ClosuresAndy On Closures
Andy On Closures
 
Dual Embedding Space Model (DESM)
Dual Embedding Space Model (DESM)Dual Embedding Space Model (DESM)
Dual Embedding Space Model (DESM)
 
5. manuel arcedillo & juanjo arevalillo (hermes) translation memories
5. manuel arcedillo & juanjo arevalillo (hermes) translation memories5. manuel arcedillo & juanjo arevalillo (hermes) translation memories
5. manuel arcedillo & juanjo arevalillo (hermes) translation memories
 
Coding standard and coding guideline
Coding standard and coding guidelineCoding standard and coding guideline
Coding standard and coding guideline
 
Java platform
Java platformJava platform
Java platform
 
Elements of Text Mining Part - I
Elements of Text Mining Part - IElements of Text Mining Part - I
Elements of Text Mining Part - I
 
Coding standards
Coding standardsCoding standards
Coding standards
 
GRDDL: A Pictorial Approach
GRDDL: A Pictorial ApproachGRDDL: A Pictorial Approach
GRDDL: A Pictorial Approach
 
OCR using Tesseract
OCR using TesseractOCR using Tesseract
OCR using Tesseract
 

Viewers also liked

Letter writing Introduction
Letter writing IntroductionLetter writing Introduction
Letter writing Introduction
gavinnancarrow
 
Self Tour Packages presentation
Self Tour Packages presentationSelf Tour Packages presentation
Self Tour Packages presentation
Kate Sevilla
 
Design one intro letter
Design one intro letterDesign one intro letter
Design one intro letter
design-print
 
Sample business introduction letter
Sample business introduction letterSample business introduction letter
Sample business introduction letter
stevepiko
 

Viewers also liked (6)

introduction letter
introduction letterintroduction letter
introduction letter
 
Letter writing Introduction
Letter writing IntroductionLetter writing Introduction
Letter writing Introduction
 
Self Tour Packages presentation
Self Tour Packages presentationSelf Tour Packages presentation
Self Tour Packages presentation
 
Design one intro letter
Design one intro letterDesign one intro letter
Design one intro letter
 
Tour package
Tour packageTour package
Tour package
 
Sample business introduction letter
Sample business introduction letterSample business introduction letter
Sample business introduction letter
 

Similar to Reg Ex

Programming in Computational Biology
Programming in Computational BiologyProgramming in Computational Biology
Programming in Computational Biology
AtreyiB
 
How to use hiatus
How to use hiatusHow to use hiatus
How to use hiatus
Ayumu Hanba
 
Can someone please fix my code for a hashtable frequencey counter I.pdf
Can someone please fix my code for a hashtable frequencey counter I.pdfCan someone please fix my code for a hashtable frequencey counter I.pdf
Can someone please fix my code for a hashtable frequencey counter I.pdf
anjandavid
 
Programming languages vienna
Programming languages viennaProgramming languages vienna
Programming languages vienna
greg_s
 
Javascript正则表达式
Javascript正则表达式Javascript正则表达式
Javascript正则表达式
ji guang
 

Similar to Reg Ex (20)

Programming in Computational Biology
Programming in Computational BiologyProgramming in Computational Biology
Programming in Computational Biology
 
Regular Expressions -- SAS and Perl
Regular Expressions -- SAS and PerlRegular Expressions -- SAS and Perl
Regular Expressions -- SAS and Perl
 
Generics Past, Present and Future
Generics Past, Present and FutureGenerics Past, Present and Future
Generics Past, Present and Future
 
Reference Scope Identification in Citing Sentences
Reference Scope Identification in Citing SentencesReference Scope Identification in Citing Sentences
Reference Scope Identification in Citing Sentences
 
JavaScript.pptx
JavaScript.pptxJavaScript.pptx
JavaScript.pptx
 
How to use hiatus
How to use hiatusHow to use hiatus
How to use hiatus
 
Generics Past, Present and Future (Latest)
Generics Past, Present and Future (Latest)Generics Past, Present and Future (Latest)
Generics Past, Present and Future (Latest)
 
Regular expressions and php
Regular expressions and phpRegular expressions and php
Regular expressions and php
 
Coffee 'n code: Regexes
Coffee 'n code: RegexesCoffee 'n code: Regexes
Coffee 'n code: Regexes
 
Can someone please fix my code for a hashtable frequencey counter I.pdf
Can someone please fix my code for a hashtable frequencey counter I.pdfCan someone please fix my code for a hashtable frequencey counter I.pdf
Can someone please fix my code for a hashtable frequencey counter I.pdf
 
Post-editese: an Exacerbated Translationese (presentation at MT Summit 2019)
Post-editese: an Exacerbated Translationese (presentation at MT Summit 2019)Post-editese: an Exacerbated Translationese (presentation at MT Summit 2019)
Post-editese: an Exacerbated Translationese (presentation at MT Summit 2019)
 
Programming languages vienna
Programming languages viennaProgramming languages vienna
Programming languages vienna
 
Python Workshop. LUG Maniapl
Python Workshop. LUG ManiaplPython Workshop. LUG Maniapl
Python Workshop. LUG Maniapl
 
RegEx Parsing
RegEx ParsingRegEx Parsing
RegEx Parsing
 
Parsing Expression Grammars
Parsing Expression GrammarsParsing Expression Grammars
Parsing Expression Grammars
 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007
 
Bioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introductionBioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introduction
 
Javascript正则表达式
Javascript正则表达式Javascript正则表达式
Javascript正则表达式
 
Maxbox starter20
Maxbox starter20Maxbox starter20
Maxbox starter20
 
Java q ref 2018
Java q ref 2018Java q ref 2018
Java q ref 2018
 

Recently uploaded

Recently uploaded (20)

WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
BusinessGPT - Security and Governance for Generative AI
BusinessGPT  - Security and Governance for Generative AIBusinessGPT  - Security and Governance for Generative AI
BusinessGPT - Security and Governance for Generative AI
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - Kanchana
 
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAMWSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
 
Driving Innovation: Scania's API Revolution with WSO2
Driving Innovation: Scania's API Revolution with WSO2Driving Innovation: Scania's API Revolution with WSO2
Driving Innovation: Scania's API Revolution with WSO2
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
 
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
 
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 

Reg Ex

  • 1. TEXT PARSING THE EASY WAY Regular Expressions March 7-8, 2015 Copyright © Jeff Hart, 2015 1 J e f f H a r t V a n i s h i n g C l o u d s , I n c .
  • 2. Levels of Pain  Regular expressions by copying  Leveraging (special) metachars  Advanced topics  Environment  Substitutions  Automating testing  Syntax influences Novice Apprentice Journeyman Master Copyright © Jeff Hart, 2015 2
  • 3. Why?  Language for parsing text  Spawned Perl  Native type in JavaScript  First class (class) in .Net  Largely independent of host environment  Line breaks, case sensitivity, etc.  Replace a ton of .indexOf(), .substring(), .contains() … var regex = /hello/ig var regex = new System.Text.RegularExpressions.RegEx(@"hello"); Copyright © Jeff Hart, 2015 3
  • 4. RegEx on a Page ^ $ ?*+ {} () | [<{ . (anchors) From the beginning to the end (cardinality) …count on (backslash) …escaping (both) …parenthesis (pipe) …or (starting) …opening brackets (period) …and anything in between Copyright © Jeff Hart, 2015 4
  • 5. Scanning Method Search: "The levels of confusion: SNAFU, SUSFU, TARFU and FUBAR" FU FU FU FU FU RegEx: Copyright © Jeff Hart, 2015 5
  • 6. RegEx  Brief, terse, powerful  Getting to a “journeyman” level takes only a few hours  Use a REPL tool like PowerShell or sites like:  http://regexpal.com/  http://regexhero.net/tester/  When the only tool you know… ^$ . *+? () | <{[ Copyright © Jeff Hart, 2015 12
  • 7. SpeakerRate.com • Search for “regex” or “socalcodecamp” • http://speakerrate.com/talks/49311 -socalcodecamp -intro-to-regex Thank YOU! Copyright © Jeff Hart, 2015 13