question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Run multiple regex operations after each other

See original GitHub issue

I’m using Obsidian to collect notes on history-related topics and I tag each event with its corresponding year in the following format: #year/1942

Now I’m trying to build a table in dataview that shows me all notes for events from the 20th century. This is what the statement looks like:

TABLE WITHOUT ID 
	file.link AS Event,
	regexreplace(file.etags, "#year/", "") AS Year
WHERE contains(tags, "year/19")
sort regexreplace(file.etags, "year", "") ASC

The problem is this line in my query: regexreplace(file.etags, "#year/", "") AS Year. Using that query, I am able to cut off the first part of the tag to just show the year itself and not the full tag, which is exactly what I want. But this line also shows all other tags from the corresponding note. Therefore, I’d like to add another regex operation for that same table column so that I just see the year and nothing else - especially no other tags.

Is this implemented already or am I missing something obvious here?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
blacksmithgucommented, Oct 3, 2021

I’ve added filter documentation to to the function documentation here: https://blacksmithgu.github.io/obsidian-dataview/query/functions/#objects-arrays-and-string-operations.

0reactions
blacksmithgucommented, Oct 12, 2021

You can try parsing the date and then extracting the fields you want via a dateformat -

dateformat(date(datum), "mm-dd")
Read more comments on GitHub >

github_iconTop Results From Across the Web

notepad++ - Execute multiple regex one after another or ...
To achieve the above result I will do some set of regex operation one after another. Find- .*/ Replace- Find- Device=:.* Replace- Find-...
Read more >
How do you match multiple Regex patterns for a single line of ...
I think you can use the | operator of the regex and put the different regexes in paranthesis to be considered one whole...
Read more >
Too Many Repetitions - Runaway Regular Expressions
When trying to match oneoneone the engine repeats the group 3 times. It stores a backtracking position for the quantifier before each repetition ......
Read more >
Regular Expression for And | "&" Regex - OCPsoft
Example to create logical "and" or "&" operations in regular expressions - a simple tutorial as part of the OCPsoft regular expressions guide....
Read more >
MySQL 8.0 Reference Manual :: 12.8.2 Regular Expressions
Table 12.14 Regular Expression Functions and Operators ... In MySQL 8.0.22 and later, use of a binary string with any of the MySQL...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found