You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to create a custom replacement that fixes up unnecessarily complicated URLs that seem to primarily come from copying text into Obsidian from MS office tools.
I'm not as familiar with Javascript's Regex dialect, but apparently it's only possible to use regex modifiers within a specific portion of an expression. So where as with PCRE or Python I could just use (?i)term at the front of the regex, with Javascript it seems like you have to use (?i:term). At least according to this mdm doc.
Example
I'd like to use an a custom replacement configuration like this:
The goal is to remove the redundant, and for some reason (lower case), quoted URL text as it just get's ugly and long when dealing with URLs of any significant length. (Sharepoint links are obnoxious, for example)
FYI. I'm not 100% sure that the syntax is correct for JavaScript. Regex101 doesn't seem to like, but I'm not sure why. The easy answer would be to pass modifiers directly to the RegeEx() constructor, but that would require another input field. For whatever it's worth, I got this working with PCRE2 when written as: (?i)\[([^\]]+)\]\((\S+) "\2"\)
The text was updated successfully, but these errors were encountered:
Feature Description
I'd like to create a custom replacement that fixes up unnecessarily complicated URLs that seem to primarily come from copying text into Obsidian from MS office tools.
I'm not as familiar with Javascript's Regex dialect, but apparently it's only possible to use regex modifiers within a specific portion of an expression. So where as with PCRE or Python I could just use
(?i)term
at the front of the regex, with Javascript it seems like you have to use(?i:term)
. At least according to this mdm doc.Example
I'd like to use an a custom replacement configuration like this:
Find:
\[([^\]]+)\]\((\S+) "(?i:\2)"\)
Replace:
[$1]($2)
The goal is to remove the redundant, and for some reason (lower case), quoted URL text as it just get's ugly and long when dealing with URLs of any significant length. (Sharepoint links are obnoxious, for example)
Input:
Result:
FYI. I'm not 100% sure that the syntax is correct for JavaScript. Regex101 doesn't seem to like, but I'm not sure why. The easy answer would be to pass modifiers directly to the RegeEx() constructor, but that would require another input field. For whatever it's worth, I got this working with PCRE2 when written as:
(?i)\[([^\]]+)\]\((\S+) "\2"\)
The text was updated successfully, but these errors were encountered: