In this guide, we will discuss Clojure Regular Expressions re-find.
re-find
Returns the next regex match, if any, of string to pattern, using java.util.regex.Matcher.find()
Syntax
Following is the syntax.
(re-find pat str)
Parameters β βpatβ is the pattern which needs to be formed. βstrβ is the string in which text needs to be found based on the pattern.
Return Value β A string if a match is found based on the input string and pattern.
Example
Following is an example of re-find in Clojure.
(ns clojure.examples.example (:gen-class)) ;; This program displays Hello World (defn Example [] (def pat (re-pattern "\\d+")) (println (re-find pat "abc123de"))) (Example)
Output
The above program produces the following output.
123
Next Topic : Click Here
Pingback: Clojure - Regular Expressions re-pattern | Adglob Infosystem Pvt Ltd
Pingback: Clojure - Regular Expressions | Adglob Infosystem Pvt Ltd