Presentation is loading. Please wait.

Presentation is loading. Please wait.

Regular Expressions Pattern and String Matching in Text.

Similar presentations


Presentation on theme: "Regular Expressions Pattern and String Matching in Text."— Presentation transcript:

1 Regular Expressions Pattern and String Matching in Text

2 What is a RegEx  “Find” option but fancier  Match a “pattern” to a “string”  Cheat sheet: http://www.rexegg.com/regex-quickstart.htmlhttp://www.rexegg.com/regex-quickstart.html  Different coding languages have different RegEx syntax  But you can usually set them to read any of the other syntaxes  My favorite RegEx tester is: http://www.regexr.com/http://www.regexr.com/

3 Find any word that starts with a capital letter:

4 Find any word that starts with a capital letter and then a lower case letter:

5 Match a phrase that might be arranged differently:

6 Or dates… You can get about as fancy with this as you’d like Useful to parse larger chunks of text entered by date or number

7 Example Uses: Syria Militant Networks and Violence in Syria What sorts of networks are likely to result in infighting as opposed to alliances?

8 Example Uses:.gov Searching terabytes of this…..

9 To get counts: To say something about government attention to different issues 2008 Agency Relative Emphasis

10 RegEx: what it isn’t good for  Time consuming to do pattern matching over large data  When you have a lot of variation in spelling or phrasing  Fuzzy Sets!  Useful reference for fuzzy matches: http://www.r- bloggers.com/fuzzy-string-matching-a-survival-skill-to-tackle- unstructured-information/http://www.r- bloggers.com/fuzzy-string-matching-a-survival-skill-to-tackle- unstructured-information/


Download ppt "Regular Expressions Pattern and String Matching in Text."

Similar presentations


Ads by Google