![Clojure Regular Expressions re-find](https://adglob.in/blog/wp-content/uploads/2021/10/info@adglob.in-7-1024x576.jpg)
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