<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Regex on Micha Kops&#39; Tech Notes</title>
    <link>https://www.hascode.com/tags/regex/</link>
    <description>Recent content in Regex on Micha Kops&#39; Tech Notes</description>
    <generator>Hugo</generator>
    <language>en</language>
    <copyright>Copyright © 2010 - 2025 Micha Kops. #e9d956c0c0154a221ad83c925346a8fa0e72f866</copyright>
    <lastBuildDate>Sun, 28 Sep 2014 00:00:00 +0200</lastBuildDate>
    <atom:link href="https://www.hascode.com/tags/regex/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>JAX-RS Server API Snippets</title>
      <link>https://www.hascode.com/jax-rs-server-api-snippets/</link>
      <pubDate>Sun, 28 Sep 2014 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/jax-rs-server-api-snippets/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Because a lot of my current projects are using JAX-RS in different versions I’d like to write down and share some frequently used snippets for implementing RESTful web-services with the JAX-RS specification here.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_using_regex_in_path_expressions&#34;&gt;Using RegEx in Path Expressions&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Sometimes we need to extract multiple parameters from a path expression e.g. in the following example where year, month and day are fragments if the path.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;@GET
@Path(&amp;#34;/orders/{year:\\d{4}}-{month:\\d{2}}-{day:\\d{2}}&amp;#34;)
@Produces(MediaType.TEXT_PLAIN)
public Response getOrders(@PathParam(&amp;#34;year&amp;#34;) final int year, @PathParam(&amp;#34;month&amp;#34;) final int month, @PathParam(&amp;#34;day&amp;#34;) final int day) {
	return Response.ok(&amp;#34;Year: &amp;#34; + year + &amp;#34;, month: &amp;#34; + month + &amp;#34;, day: &amp;#34; + day).build();
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Postgres Snippets</title>
      <link>https://www.hascode.com/postgres-snippets/</link>
      <pubDate>Mon, 01 Mar 2010 00:00:00 +0100</pubDate>
      <guid>https://www.hascode.com/postgres-snippets/</guid>
      <description>&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_administration_configuration&#34;&gt;Administration &amp;amp; Configuration&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3 id=&#34;_connections&#34;&gt;Connections&lt;/h3&gt;
&lt;div class=&#34;sect3&#34;&gt;
&lt;h4 id=&#34;_show_max_connections_value_and_source&#34;&gt;Show Max Connections (value and source)&lt;/h4&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;SELECT setting, source, sourcefile, sourceline
FROM pg_settings
WHERE name = &amp;#39;max_connections&amp;#39;;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect3&#34;&gt;
&lt;h4 id=&#34;_set_max_connections&#34;&gt;Set Max Connections&lt;/h4&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;ALTER system SET max_connections = 250;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect3&#34;&gt;
&lt;h4 id=&#34;_kill_connections_for_a_database&#34;&gt;Kill Connections for a Database&lt;/h4&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;SELECT pg_terminate_backend(pid)
FROM pg_catalog.pg_stat_activity
-- we don&amp;#39;t want to kill our own connection
WHERE pid != pg_backend_pid()
-- we don&amp;#39;t want to kill connections to other databases
AND datname = &amp;#39;MYDATABASE&amp;#39;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect3&#34;&gt;
&lt;h4 id=&#34;_show_statement_timeout_settings_for_all_users&#34;&gt;Show Statement Timeout Settings for All Users&lt;/h4&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;SELECT r.rolname,
       (SELECT unnest(s.setconfig) FROM pg_db_role_setting s WHERE s.setrole = r.oid AND s.setconfig::text LIKE &amp;#39;%statement_timeout%&amp;#39; LIMIT 1) AS statement_timeout
FROM pg_roles r
WHERE r.rolcanlogin
ORDER BY r.rolname;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Vim Snippets</title>
      <link>https://www.hascode.com/vim-snippets/</link>
      <pubDate>Mon, 01 Mar 2010 00:00:00 +0100</pubDate>
      <guid>https://www.hascode.com/vim-snippets/</guid>
      <description>&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_format_json_with_jq&#34;&gt;Format JSON with jq&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code&gt;:%!jq .&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_vim_plugin_manager&#34;&gt;Vim Plugin Manager&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3 id=&#34;_installation&#34;&gt;Installation&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Download it from its &lt;a href=&#34;https://github.com/junegunn/vim-plug&#34;&gt;GitHub repository&lt;/a&gt; or the risky but easy way using curl:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3 id=&#34;_adding_plugins&#34;&gt;Adding Plugins&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Add a plugin section to the &lt;code&gt;.vimrc&lt;/code&gt;:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;title&#34;&gt;.vimrc&lt;/div&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code&gt;call plug#begin()
&amp;#34; The default plugin directory will be as follows:
&amp;#34;   - Vim (Linux/macOS): &amp;#39;~/.vim/plugged&amp;#39;
&amp;#34;   - Vim (Windows): &amp;#39;~/vimfiles/plugged&amp;#39;
&amp;#34;   - Neovim (Linux/macOS/Windows): stdpath(&amp;#39;data&amp;#39;) . &amp;#39;/plugged&amp;#39;
&amp;#34; You can specify a custom plugin directory by passing it as the argument
&amp;#34;   - e.g. `call plug#begin(&amp;#39;~/.vim/plugged&amp;#39;)`
&amp;#34;   - Avoid using standard Vim directory names like &amp;#39;plugin&amp;#39;

&amp;#34; Make sure you use single quotes

&amp;#34; Gruvbox Theme
Plug &amp;#39;sainnhe/gruvbox-material&amp;#39;

&amp;#34; Initialize plugin system
&amp;#34; - Automatically executes `filetype plugin indent on` and `syntax enable`.
call plug#end()
&amp;#34; You can revert the settings after the call like so:
&amp;#34;   filetype indent off   &amp;#34; Disable file-type-specific indentation
&amp;#34;   syntax off            &amp;#34; Disable syntax highlighting&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</description>
    </item>
  </channel>
</rss>
