In this guide, we will discuss Clojure Regular Expressions re-pattern.
re-pattern
Returns an instance of java.util.regex.Pattern. This is then used in further methods for pattern matching.
Syntax
Following is the syntax.
(re-pattern pat)
Parameters β βpatβ is the pattern which needs to be formed.
Return Value β A pattern object of the type java.util.regex.Pattern.
Example
Following is an example of re-pattern in Clojure.
(ns clojure.examples.example (:gen-class)) ;; This program displays Hello World (defn Example [] (def pat (re-pattern "\\d+"))) (Example)
The above program will create a pattern object, which will be a pattern of one or more digits.
Next Topic : Click Here
Pingback: Clojure - Regular Expressions | Adglob Infosystem Pvt Ltd