-
Book Overview & Buying
-
Table Of Contents
Getting started with Julia Programming Language
By :
To search for and match patterns in text and other data, regular expressions are an indispensable tool for the data scientist. Julia adheres to the Perl syntax of regular expressions. For a complete reference, refer to http://www.regular-expressions.info/reference.html. Regular expressions are represented in Julia as a double (or triple) quoted string preceded by r, such as r"..." (optionally, followed by one or more of the i, s, m, or x flags), and they are of type Regex. The chapter 2\regexp.jl script shows some examples.
In the first example, we will match the e-mail addresses (#> shows the result):
email_pattern = r".+@.+" input = "[email protected]" println(ismatch(email_pattern, input)) #> true
The regular expression pattern + matches any (non-empty) group of characters. Thus, this pattern matches any string that contains @ somewhere in the middle.
In the second example, we will try to determine whether a credit card number is valid...
Change the font size
Change margin width
Change background colour