Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2009 Lumina Decision Systems, Inc. Regular Expressions in Analytica 4.2 Lonnie Chrisman Lumina Decision Systems Analytica User Group 9 July.

Similar presentations


Presentation on theme: "Copyright © 2009 Lumina Decision Systems, Inc. Regular Expressions in Analytica 4.2 Lonnie Chrisman Lumina Decision Systems Analytica User Group 9 July."— Presentation transcript:

1 Copyright © 2009 Lumina Decision Systems, Inc. Regular Expressions in Analytica 4.2 Lonnie Chrisman Lumina Decision Systems Analytica User Group 9 July 2009

2 Copyright © 2009 Lumina Decision Systems, Inc. What are Regular Expressions? A standard & powerful language for recognizing or matching patterns in text. Analytica 4.2 functions FindInText, TextReplace and SplitText, can process Perl-compatible Regular Expressions. Credits: PCRE Library, University of Cambridge, © 2008.

3 Copyright © 2009 Lumina Decision Systems, Inc. Basics of RE patterns Reserved characters: \^.$|()[]{}?*+ Anything else is a literal character Some special single-character patterns:. = any character \w = “word” char (letter or ‘_’) \d = digit character (0,1,.., 9) \s = white space character Literals for reserved characters \\ \^ \. \$ \| \( \) \[ \] \{ \} \? \* \+

4 Copyright © 2009 Lumina Decision Systems, Inc. Repeating Patterns * = zero-or-more, maximal-length match *? = zero-or-more, minimal-length match + = one-or-more, maximal-length match +? = one-or-more, minimal length match ? = zero or one Text: “Now is the time for all good men” “t.*e”  “the time for all good me” “t.*?e”  “the”

5 Copyright © 2009 Lumina Decision Systems, Inc. Disjunction a|b|c : a or b or c (patterns) [abc] : a or b or c (characters) [a-zA-z] : any letter [^abc] : any character except a,b, or c

6 Copyright © 2009 Lumina Decision Systems, Inc. Grouping and Subpatterns ("(\d[\d\,]*)")|(\d+) Subpatterns: 0 : ("(\d[\d\,]*)")|(\d+) 1 : "(\d[\d\,]*)" 2 : \d[\d\,]* 3 : \d+


Download ppt "Copyright © 2009 Lumina Decision Systems, Inc. Regular Expressions in Analytica 4.2 Lonnie Chrisman Lumina Decision Systems Analytica User Group 9 July."

Similar presentations


Ads by Google