Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geedy tag matching and punctuation #1103

Open
amorfee opened this issue Apr 9, 2024 · 2 comments
Open

Geedy tag matching and punctuation #1103

amorfee opened this issue Apr 9, 2024 · 2 comments

Comments

@amorfee
Copy link

amorfee commented Apr 9, 2024

Hello,

I've come across an issue with greedy tag matching and comma separation. The comma is included as part of the match so that multiple tags are combined into one match.

Screenshot 2024-04-09 at 11 08 39

This is likely expected behaviour for a tag such as #Place but is there a way to force the comma as a word separator? Using .normalize() doesn't seem to help it just removes the comma from the match.

Thank you

@spencermountain
Copy link
Owner

spencermountain commented Apr 9, 2024

hey, yeah good question. There are a few ways you could do this.

You could split by whatever, then filter then down:

let parts = doc.splitAfter('@hasComma');
parts = parts.if('#Place')

I sometimes do a aggressive split and then join em up, which is probably a weirder process:

let parts = doc.split('#Place')
parts= parts.joinIf('#Place && @hasComma', '#Place')

dunno!
cheers

@amorfee
Copy link
Author

amorfee commented Apr 9, 2024

Thank you, .splitAfter() seems to do what we need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants