regex-generator.olafneumann.org Open in urlscan Pro
2606:50c0:8001::153  Public Scan

Submitted URL: http://regex-generator.olafneumann.org/
Effective URL: https://regex-generator.olafneumann.org/
Submission: On September 13 via manual from US — Scanned from DE

Form analysis 1 forms found in the DOM

<form>
  <div class="form-group m-2 rg-check-box">
    <div class="form-check">
      <input type="checkbox" class="form-check-input" id="rg_caseinsensitive" aria-describedby="rg_caseinsensitive_help">
      <label class="form-check-label" for="rg_caseinsensitive">Case Insensitive</label>
    </div>
    <small id="rg_caseinsensitive_help" class="form-text text-muted mt-0"> By default, all major regex engines match in case-sensitive mode. If you want patterns such as <span class="border rg-code p-1 bg-white">Name: [a-z]+</span> to match in
      case-insensitive fashion, we need to turn that feature on.<a class="text-decoration-none" href="https://www.rexegg.com/regex-modifiers.html#i" target="_blank" rel="noopener">*</a>
    </small>
  </div>
  <div class="form-group m-2 rg-check-box">
    <div class="form-check">
      <input type="checkbox" class="form-check-input" id="rg_dotmatcheslinebreakes" aria-describedby="rg_dotmatcheslinebreakes_help">
      <label class="form-check-label" for="rg_dotmatcheslinebreakes">Dot Matches Line Breaks</label>
    </div>
    <small id="rg_dotmatcheslinebreakes_help" class="form-text text-muted mt-0"> By default, the dot <span class="border rg-code p-1 bg-white">.</span> doesn't match line break characters such as line feeds and carriage returns. If you want patterns
      such as <span class="border rg-code p-1 bg-white">BEGIN .*? END</span> to match across lines, we need to turn that feature
      on.<a class="text-decoration-none" href="https://www.rexegg.com/regex-modifiers.html#dotall" target="_blank" rel="noopener">*</a></small>
  </div>
  <div class="form-group m-2 rg-check-box">
    <div class="form-check">
      <input type="checkbox" class="form-check-input" id="rg_multiline" aria-describedby="rg_multiline_help">
      <label class="form-check-label" for="rg_multiline">Multiline</label>
    </div>
    <small id="rg_multiline_help" class="form-text text-muted mt-0"> By default, most major engines (except Ruby), the anchors <span class="border rg-code p-1 bg-white">^</span> and <span class="border rg-code p-1 bg-white">$</span> only match
      (respectively) at the beginning and the end of the string. In other engines, if you want patterns such as <span class="border rg-code p-1 bg-white">^Define</span> and <span class="border rg-code p-1 bg-white">&gt;&gt;&gt;$</span> to match
      (respectively) at the beginning and the end of each line, we need to turn that feature on.<a class="text-decoration-none" href="https://www.rexegg.com/regex-modifiers.html#multiline" target="_blank" rel="noopener">*</a></small>
  </div>
</form>

Text Content

This site uses cookies to improve your user experience.

Reject Accept


REGEX GENERATOR

CREATING REGULAR EXPRESSIONS IS EASY AGAIN!





1

PASTE A SAMPLE TEXT.

We have shortened the input to 1000 characters to speed up processing.
Give us an example of the text you want to match using your regex. We will
provide you with some ideas how to build a regular expression.


2

WHICH PARTS OF THE TEXT ARE INTERESTING FOR YOU?

2020-03-12T13:34:56.123Z INFO [org.example.Class]: This is a #simple #logline
containing a 'value'.
Character (2)
Digit
Character (0)
Digit
Character (2)
Digit
Character (0)
Digit
Character (-)
Character (0)
Digit
Character (3)
Digit
Character (-)
Floating point number (with optional exponent)
Character (1)
Digit
Character (2)
Digit
Character (T)
One arbitrary character
Multiple characters
Character (1)
Digit
Character (3)
Digit
Character (:)
Character (3)
Digit
Character (4)
Digit
Character (:)
Character (5)
Digit
Character (6)
Digit
Character (.)
Character (1)
Digit
Character (2)
Digit
Character (3)
Digit
Character (Z)
One arbitrary character
Multiple characters
Character ( )
One whitespace
Whitespaces
Character (I)
One arbitrary character
Character (N)
One arbitrary character
Character (F)
One arbitrary character
Character (O)
One arbitrary character
Character ( )
One whitespace
Character ( )
One whitespace
Character ([)
Character (o)
One arbitrary character
Character (r)
One arbitrary character
Character (g)
One arbitrary character
Character (.)
Character (e)
One arbitrary character
Character (x)
One arbitrary character
Character (a)
One arbitrary character
Character (m)
One arbitrary character
Character (p)
One arbitrary character
Character (l)
One arbitrary character
Character (e)
One arbitrary character
Character (.)
Character (C)
One arbitrary character
Character (l)
One arbitrary character
Character (a)
One arbitrary character
Character (s)
One arbitrary character
Character (s)
One arbitrary character
Character (])
Character (:)
Character ( )
One whitespace
Whitespaces
Character (T)
One arbitrary character
Character (h)
One arbitrary character
Character (i)
One arbitrary character
Character (s)
One arbitrary character
Character ( )
One whitespace
Whitespaces
Character (i)
One arbitrary character
Character (s)
One arbitrary character
Character ( )
One whitespace
Whitespaces
Character (a)
One arbitrary character
Multiple characters
Alphanumeric characters
Character ( )
One whitespace
Whitespaces
Character (#)
Character (s)
One arbitrary character
Character (i)
One arbitrary character
Character (m)
One arbitrary character
Character (p)
One arbitrary character
Character (l)
One arbitrary character
Character (e)
One arbitrary character
Character ( )
One whitespace
Whitespaces
Character (#)
Character (l)
One arbitrary character
Character (o)
One arbitrary character
Character (g)
One arbitrary character
Character (l)
One arbitrary character
Character (i)
One arbitrary character
Character (n)
One arbitrary character
Character (e)
One arbitrary character
Character ( )
One whitespace
Whitespaces
Character (c)
One arbitrary character
Character (o)
One arbitrary character
Character (n)
One arbitrary character
Character (t)
One arbitrary character
Character (a)
One arbitrary character
Character (i)
One arbitrary character
Character (n)
One arbitrary character
Character (i)
One arbitrary character
Character (n)
One arbitrary character
Character (g)
One arbitrary character
Character ( )
One whitespace
Whitespaces
Character (a)
One arbitrary character
Multiple characters
Alphanumeric characters
Character ( )
One whitespace
Whitespaces
Character (')
Character (v)
One arbitrary character
Character (a)
One arbitrary character
Character (l)
One arbitrary character
Character (u)
One arbitrary character
Character (e)
One arbitrary character
Character (')
Character (.)
ISO8601
Combination [Whitespaces + Multiple characters]
Square brackets
Combination [One whitespace + Multiple characters]
Combination [Whitespaces + Multiple characters]
Hashtag
Hashtag
Combination [One whitespace + Multiple characters]
Combination [Whitespaces + Multiple characters]
String (apostrophe)
Combination [Alphanumeric characters + Character]
Exact number (34)
Number
Floating point number (with optional exponent)
Alphanumeric characters
Combination [Alphanumeric characters + Character]
Combination [One whitespace + Multiple characters]
Square brackets content (no square bracket)
Combination [Alphanumeric characters + Character]
Combination [Multiple characters + Character]
Combination [Alphanumeric characters + Character]
Combination [Multiple characters + Character]
Combination [One whitespace + Hashtag]
Combination [Whitespaces + Hashtag]
Multiple characters
Alphanumeric characters
Multiple characters
Alphanumeric characters
String (apostrophe) content (no apostrophe)
String (apostrophe) content (backslash escaped apostrophe)
String (apostrophe) content (double escaped apostrophe)
Date
Combination [Number + Character]
Time
Combination [Floating point number (with optional exponent) + Character]
Combination [Multiple characters + Character]
Whitespaces
Multiple characters
Alphanumeric characters
Multiple characters
Alphanumeric characters
Multiple characters
Alphanumeric characters
Multiple characters
Alphanumeric characters
Multiple characters
Alphanumeric characters
Multiple characters
Alphanumeric characters
Combination [Alphanumeric characters + Character]
Combination [Multiple characters + Character]
Combination [Exact number + Character]
Combination [Alphanumeric characters + Character]
Combination [Alphanumeric characters + Character]
Multiple characters
Alphanumeric characters
Exact number (2020)
Number
Floating point number (with optional exponent)
Alphanumeric characters
Floating point number (with optional exponent)
Alphanumeric characters
Decimal number
Multiple characters
Alphanumeric characters
Log level
Exact number (03)
Number
Alphanumeric characters
Day
Month
Hour
Minute/ Second
Exact number (12)
Number
Combination [Number + Character]
Alphanumeric characters
Floating point number (with optional exponent)
Floating point number (with optional exponent)
Combination [Exact number + Character]
Floating point number (with optional exponent)
Exact number (123)
Number
Exact number (13)
Number
Floating point number (with optional exponent)
Day
Hour
Minute/ Second
Exact number (56)
Number
Alphanumeric characters
Minute/ Second
Click on the marked suggestions to select them for your regular expression.


3

OPTIONS

Generate Only Patterns
When this option is checked, the generated regular expression will only contain
the patterns that you selected in step 2. Otherwise, all characters between the
patterns will be copied.
Match Whole Line
Would you like the generated regular expression to match all the input?
Generate Lower Case
By default this page will generate character classes like [A-Za-z] for upper and
lower cases. Activating this box will only generate lower case character
classes.
abcde
Mark the parts of the regular expression you want to capture.

CAPTURING GROUPS




4

REGULAR EXPRESSION

2020-03-12T13:34:56\.123Z INFO \[org\.example\.Class\]: This is a #simple
#logline containing a 'value'\.
Hover the generated regular expression to see more information.
Copy regex


5

USAGE IN PROGRAMMING LANGUAGES

C (regex.h)

#include <regex.h>

int useRegex(char* textToCheck) {
    regex_t compiledRegex;
    int reti;
    int actualReturnValue = -1;
    char messageBuffer[100];

    /* Compile regular expression */
    reti = regcomp(&compiledRegex, "2020-03-12T13:34:56\\.123Z INFO  \\[org\\.example\\.Class\\]: This is a #simple #logline containing a 'value'\\.", REG_EXTENDED | REG_ICASE);
    if (reti) {
        fprintf(stderr, "Could not compile regex\n");
        return -2;
    }

    /* Execute compiled regular expression */
    reti = regexec(&compiledRegex, textToCheck, 0, NULL, 0);
    if (!reti) {
        puts("Match");
        actualReturnValue = 0;
    } else if (reti == REG_NOMATCH) {
        puts("No match");
        actualReturnValue = 1;
    } else {
        regerror(reti, &compiledRegex, messageBuffer, sizeof(messageBuffer));
        fprintf(stderr, "Regex match failed: %s\n", messageBuffer);
        actualReturnValue = -3;
    }

    /* Free memory allocated to the pattern buffer by regcomp() */
    regfree(&compiledRegex);
    return actualReturnValue;
}

C#

using System;
using System.Text.RegularExpressions;

public class Sample
{
    public static bool useRegex(String input)
    {
        const Regex regex = new Regex("2020-03-12T13:34:56\\.123Z INFO  \\[org\\.example\\.Class\\]: This is a #simple #logline containing a 'value'\\.", RegexOptions.IgnoreCase);
        return regex.IsMatch(input);
    }
}

Go

package main

import (
	"regexp"
)

func useRegex(s string) bool {
	re := regexp.MustCompile("(?i)2020-03-12T13:34:56\\.123Z INFO  \\[org\\.example\\.Class\\]: This is a #simple #logline containing a 'value'\\.")
	return re.MatchString(s)
}

grep

grep on mac OS does not support option -P (for Perl regex). To make it work,
install a better grep (e.g. brew install grep). Most regex will work without -P.

grep -P -i '2020-03-12T13:34:56\.123Z INFO  \[org\.example\.Class\]: This is a #simple #logline containing a '"'"'value'"'"'\.' [FILE...]

Java

import java.util.regex.Pattern;
import java.util.regex.Matcher;

public class Sample {
    public static boolean useRegex(final String input) {
        // Compile regular expression
        final Pattern pattern = Pattern.compile("2020-03-12T13:34:56\\.123Z INFO  \\[org\\.example\\.Class\\]: This is a #simple #logline containing a 'value'\\.", Pattern.CASE_INSENSITIVE);
        // Match regex against input
        final Matcher matcher = pattern.matcher(input);
        // Use results...
        return matcher.matches();
    }
}

JavaScript

function useRegex(input) {
    let regex = /2020-03-12T13:34:56\.123Z INFO  \[org\.example\.Class\]: This is a #simple #logline containing a 'value'\./i;
    return regex.test(input);
}

Kotlin

fun useRegex(input: String): Boolean {
    val regex = Regex(pattern = "2020-03-12T13:34:56\\.123Z INFO  \\[org\\.example\\.Class\\]: This is a #simple #logline containing a 'value'\\.", options = setOf(RegexOption.IGNORE_CASE))
    return regex.matches(input)
}

PHP

<?php
function useRegex($input) {
    $regex = '/2020-03-12T13:34:56\\.123Z INFO  \\[org\\.example\\.Class\\]: This is a #simple #logline containing a \'value\'\\./i';
    return preg_match($regex, $input);
}
?>

Python

import re

def use_regex(input_text):
    pattern = re.compile(r"2020-03-12T13:34:56\.123Z INFO  \[org\.example\.Class\]: This is a #simple #logline containing a 'value'\.", re.IGNORECASE)
    return pattern.match(input_text)

Ruby

def use_regex(input)
    regex = Regexp.new('2020-03-12T13:34:56\\.123Z INFO  \\[org\\.example\\.Class\\]: This is a #simple #logline containing a \'value\'\\.', Regexp::IGNORECASE)
    regex.match input
end

Swift

func useRegex(for text: String) -> Bool {
    let regex = try! NSRegularExpression(pattern: "2020-03-12T13:34:56\\.123Z INFO  \\[org\\.example\\.Class\\]: This is a #simple #logline containing a 'value'\\.", options: [.caseInsensitive])
    let range = NSRange(location: 0, length: text.count)
    let matches = regex.matches(in: text, options: [], range: range)
    return matches.first != nil
}

Visual Basic .NET

Imports System.Text.RegularExpressions

Public Module Sample
    Public Function useRegex(ByVal input As String) As Boolean
        Dim regex = New Regex("2020-03-12T13:34:56\.123Z INFO  \[org\.example\.Class\]: This is a #simple #logline containing a 'value'\.", RegexOptions.IgnoreCase)
        Return regex.IsMatch(input)
    End Function
End Module

Please note that these code samples are automatically generated. They are not
guaranteed to work. If you find a syntax error, please submit a bug report.
Case Insensitive
By default, all major regex engines match in case-sensitive mode. If you want
patterns such as Name: [a-z]+ to match in case-insensitive fashion, we need to
turn that feature on.*
Dot Matches Line Breaks
By default, the dot . doesn't match line break characters such as line feeds and
carriage returns. If you want patterns such as BEGIN .*? END to match across
lines, we need to turn that feature on.*
Multiline
By default, most major engines (except Ruby), the anchors ^ and $ only match
(respectively) at the beginning and the end of the string. In other engines, if
you want patterns such as ^Define and >>>$ to match (respectively) at the
beginning and the end of each line, we need to turn that feature on.*

SHARE

To share the current page content and settings, use the following link:

https://regex-generator.olafneumann.org/?sampleText=2020-03-12T13%3A34%3A56.123Z%20INFO%20%20%5Borg.example.Class%5D%3A%20This%20is%20a%20%23simple%20%23logline%20containing%20a%20%27value%27.&flags=i

REGEX GENERATOR

The idea for this page comes from txt2re, which seems to be discontinued.

The aim of this page is to give as many people as possible the opportunity to
develop and use regular expressions. Hopefully nobody has to call substring()
anymore.

Find the project sources at Github.

--------------------------------------------------------------------------------

USEFUL REGEX LINKS

 * Regular Expressions 101
 * Regexr
   
 * RegexPlanet
   
 * RexEgg
 * Regex DB

THIS PROJECT IS BUILT USING

 * Kotlin
 * Bootstrap
 * Prismjs
 * Driver.js
 * kotlin-multiplatform-diff

© 2020-2023 Copyright Olaf Neumann








New to Regex Generator
Hi! It looks like you're new to Regex Generator. Let us show you how to use this
tool.
Close ← Previous Next →