Regex

There is more than one way to use regex in Muninn.

Predefined Regex

List of available predefined regex

  • email

  • url

HTML
<div class="parent">
  <div class="contact">Email: test@mail.com</div>
  <div class="website">Website: www.test.com</div>
  <div class="year">Year: 2021</div>
</div>
Config
{
    "email": {
        "selector": ".contact",
        "regex": "email"
    },
    "url": {
        "selector": ".website",
        "regex": "url"
    },
}

// or use this shortcut

{
    "email": ".contact | email",
    "url": ".website | url",
}
Output
{
    "email": "test@mail.com",
    "url": "www.test.com" ,
}

Define As Object

Config
{
    "year": {
        "selector": ".year",
        "regex": {
            "pattern": "\\d+", 
            "flags": "g"
        }
    },
}

Define As Regex

Config
{
    "year": {
        "selector": ".year",
        "regex": /\d+/g
    },
}

Last updated