blacksmithgu / obsidian-dataview

A data index and query language over Markdown files, for https://obsidian.md/.
https://blacksmithgu.github.io/obsidian-dataview/
MIT License
6.97k stars 410 forks source link

regex replace #108

Closed timconnorz closed 3 years ago

timconnorz commented 3 years ago

it would be cool to be able to run a replace function using regex as the pattern

(sorry if this is already possible)

blacksmithgu commented 3 years ago

regexreplace(pattern, field, replacement) has been added in 0.2.10. Has the same semantics as JS replacement does, so you can use special operators like '$1' to refer to the first capture group, and so on (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace).

blacksmithgu commented 3 years ago

Order is actually regexreplace(field, pattern, replacement) to match replace().