Username at-matching fails when substring is also a usermatch and is tagged first

TalkBug Collectors

Join LibraryThing to post.

Username at-matching fails when substring is also a usermatch and is tagged first

This topic is currently marked as "dormant"—the last message is more than 90 days old. You can revive it by posting a reply.

1lorax
Dec 20, 2013, 8:52 am

First noticed in this post, where brightcopy at-tagged both his own username and that of his test account, brightcopytest; both of them just linked to brightcopy. (Like this: @brightcopy @brightcopytest )

See fairly extensive testing here:

http://www.librarything.com/topic/162369

From what I can tell, if:

1. A leading substring of the tagged username is also a valid username, AND
2. That username has already been tagged in the same post

Then the @ tag will just resolve to the substring-username. This has to have been put in deliberately, and was most likely done to deal with things like punctuation. But slapping in a word-boundary requirement on the match doesn't seem too hard. (Nor, admittedly, is this anything like a high priority, since it's decidedly a corner case.

2Keeline
Dec 27, 2013, 7:02 pm

It is as if the first and shortest match that can be made is taken. This is the opposite of regular expression matching where the default is for it to be "greedy" and make the largest match possible unless modifying characters are used to alter this behavior.

If the list of potential matches was taken in reverse alphabetical order or from longest to shortest, the result might be different.

James

3lorax
Dec 30, 2013, 9:41 am

2>

Yes, but only if that shortest match is also tagged earlier in the same post. It's not just blind substring matching, it's deliberate logic.

4Keeline
Dec 30, 2013, 10:25 am

It does sound as if something not quite right is in this code if that is how it is handled.

James

5lorax
Dec 30, 2013, 10:36 am

4>

Yes, that's why this is a bug report.

6lorax
Feb 27, 2014, 11:09 am

Bump.

7timspalding
Apr 23, 2014, 1:22 am

8timspalding
Apr 23, 2014, 1:27 am

Fixed. Thanks.