{"result":{"depiction_url":null,"edges":{"hasreference":{"objects":[{"created":"2026-10-07T11:13:42Z","object_id":{"id":1538,"is_a":["text","documentation","cookbook"],"name":"doc_cookbook_shell_characters","title":{"_type":"trans","tr":{"en":"Normalize and filter Unicode text"}},"uri":"https:\/\/zotonic.com\/id\/1538"},"seq":1},{"created":"2026-10-07T11:13:42Z","object_id":{"id":1419,"is_a":["text","documentation","developerguide"],"name":"doc_developerguide_forms_and_validation","title":{"_type":"trans","tr":{"en":"Validate a form on both sides"}},"uri":"https:\/\/zotonic.com\/id\/1419"},"seq":2}],"predicate":{"id":2774,"is_a":["meta","predicate"],"name":"hasreference","title":{"_type":"trans","tr":{"en":"Documentation reference"}},"uri":"https:\/\/zotonic.com\/id\/hasreference"}},"subject":{"objects":[{"created":"2026-10-07T11:13:42Z","object_id":{"id":2553,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_tutorial","title":"Tutorial","uri":"https:\/\/zotonic.com\/id\/2553"},"seq":1},{"created":"2026-10-07T11:13:42Z","object_id":{"id":2564,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_backend_developer","title":"Backend developer","uri":"https:\/\/zotonic.com\/id\/2564"},"seq":2},{"created":"2026-10-07T11:13:42Z","object_id":{"id":2612,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_data_processing_and_formatting","title":"Data processing and formatting","uri":"https:\/\/zotonic.com\/id\/2612"},"seq":3},{"created":"2026-10-07T11:13:42Z","object_id":{"id":2670,"is_a":["categorization","keyword","keyword_technology"],"name":"zotonic_topic_erlang_otp","title":"Erlang\/OTP","uri":"https:\/\/zotonic.com\/id\/2670"},"seq":4},{"created":"2026-10-07T11:13:42Z","object_id":{"id":2659,"is_a":["categorization","keyword","keyword_data_type"],"name":"zotonic_topic_text","title":"Text","uri":"https:\/\/zotonic.com\/id\/2659"},"seq":5}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"export_revision":35,"id":1601,"is_a":["text","documentation","cookbook"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1601"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_cookbook_justenough_re","page_url":{"en":"https:\/\/zotonic.com\/cookbook\/1601\/use-regular-expressions-with-erlang-otp-28","x-default":"https:\/\/zotonic.com\/cookbook\/1601\/use-regular-expressions-with-erlang-otp-28"},"preview_url":null,"resource":{"body":{"_type":"trans","tr":{"en":"<p>OTP 28 uses PCRE2 for <code>re<\/code>. Re-test expressions carried over from older Erlang releases, especially Unicode classes and unusual escape sequences. See the <a href=\"https:\/\/www.erlang.org\/docs\/28\/apps\/stdlib\/re.html\">OTP 28 re reference<\/a>.<\/p>\n<p>In a practice Erlang shell:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">re:run(&lt;&lt;&quot;Order 123&quot;&gt;&gt;, &lt;&lt;&quot;[0-9]+&quot;&gt;&gt;, [{capture, first, binary}]).\n% {match,[&lt;&lt;&quot;123&quot;&gt;&gt;]}\nre:run(&lt;&lt;&quot;Order abc&quot;&gt;&gt;, &lt;&lt;&quot;[0-9]+&quot;&gt;&gt;, [{capture, none}]).\n% nomatch\nre:replace(&lt;&lt;&quot;a   b&quot;&gt;&gt;, &lt;&lt;&quot;\\\\s+&quot;&gt;&gt;, &lt;&lt;&quot; &quot;&gt;&gt;, [global, {return, binary}]).\n% &lt;&lt;&quot;a b&quot;&gt;&gt;\n<\/code><\/pre>\n<p><code>+<\/code> repeats the preceding expression one or more times; <code>*<\/code> allows zero occurrences too. <code>^<\/code> and <code>$<\/code> anchor a match. Erlang string and binary literals need an extra backslash to pass a backslash to the regex engine.<\/p>\n<p>For repeated matching, compile once and handle both success and failure:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">{ok, Pattern} = re:compile(&lt;&lt;&quot;^[0-9]+$&quot;&gt;&gt;),\nmatch = re:run(&lt;&lt;&quot;123&quot;&gt;&gt;, Pattern, [{capture, none}]),\nnomatch = re:run(&lt;&lt;&quot;abc&quot;&gt;&gt;, Pattern, [{capture, none}]).\n<\/code><\/pre>\n<p>Treat the compiled pattern as opaque. Do not copy its printed internal tuple into source code. For UTF-8 input, use <code>unicode<\/code>; add <code>ucp<\/code> when character classes should use Unicode properties. Do not use a small regex as a complete email-address validator: use the form validator and verify address ownership when required.<\/p>"}},"category_id":{"id":318,"is_a":["meta","category"],"name":"cookbook","title":{"_type":"trans","tr":{"en":"Cookbook"}},"uri":"https:\/\/test.zotonic.com\/id\/318"},"content_group_id":{"id":339,"is_a":["meta","content_group"],"name":"default_content_group","title":{"_type":"trans","tr":{"en":"Default Content Group"}},"uri":"https:\/\/zotonic.com\/id\/default_content_group"},"created":"2020-05-30T05:47:27Z","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"doc_editorial_bundle":true,"doc_editorial_edges":{"hasreference":[1419,1538],"subject":[2553,2564,2612,2659,2670]},"github_url":"https:\/\/github.com\/zotonic\/zotonic\/tree\/master\/doc\/cookbook\/justenough-re.rst","is_authoritative":true,"is_dependent":false,"is_featured":false,"is_protected":false,"is_published":true,"is_unfindable":false,"language":["en"],"modified":"2026-10-07T11:13:52Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"name":"doc_cookbook_justenough_re","pivot_geocode":null,"pivot_location_lat":null,"pivot_location_lng":null,"privacy":0,"publication_end":"9999-06-01T00:00:00Z","publication_start":"2022-02-15T10:01:41Z","slug":"use-regular-expressions-with-erlang-otp-28","summary":{"_type":"trans","tr":{"en":"Match and replace UTF-8 text with the current re module."}},"title":{"_type":"trans","tr":{"en":"Use regular expressions with Erlang\/OTP 28"}},"title_slug":{"_type":"trans","tr":{"en":"use-regular-expressions-with-erlang-otp-28"}},"tz":"UTC","uri":null,"version":35,"visible_for":0},"uri":"https:\/\/zotonic.com\/id\/1601","uri_template":"https:\/\/zotonic.com\/id\/:id","version":35,"websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1601"}},"status":"ok"}