Character Name Highlighting Discrepancy

56 views
Skip to first unread message

Andrew Applegarth

unread,
May 1, 2026, 12:45:33 PMMay 1
to yWriter
I have a character named Eleanor in one of my stories.  In rereading bits to make sure I remain consistent on certain plot points, I noticed that I occasionally spelled her name as Eleanore instead.

The issue is, yWriter is highlighting both Eleanor and Eleanore as recognized names.  I double-checked the character entry, and there is nothing in any of the three fields that has an e on the end.  I don't have any other characters with Eleanore in their name either.

I did a bit of testing after Is started writing this, and it appears that I can add one character to the end of any name and it will still highlight it as a valid name.  Letters, numbers, and even special characters all work.  Adding a second character results in it not being highlighted.

I'm running the 7.1.6.3 alpha release, which I believe is the latest, but I confirmed this also happens in the 7.1.5.2 version I have installed.

Simon Haynes

unread,
May 24, 2026, 12:57:56 PMMay 24
to ywr...@googlegroups.com
I can see why - some time ago I modified the search so it will find the character name plus ['s] in case it's a possessive.  I think it's highlighting Eleanore because I have too wide a search (instead of A-Za-z0-9 is should probably just be an 's'

image.png

--
Visit Spacejock Software, the home of yWriter, FCharts and more
Visit spacejock.com.au for my articles on writing and publishing novels.


--
You received this message because you are subscribed to the Google Groups "yWriter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ywriter+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ywriter/5206bfb9-8851-4e9c-8003-ee86c102bd72n%40googlegroups.com.

Andrew Applegarth

unread,
May 24, 2026, 10:54:58 PMMay 24
to yWriter
I agree that you probably only need the s, but the issue would appear to be that it's not requiring the apostrophe before matching an additional letter.  I think removing the question mark after the single quote would fix that.

Maybe that was to support the plural of last names, but again it would just need the s.

Andrew Applegarth

unread,
May 25, 2026, 5:31:19 PMMay 25
to yWriter
My regex skills are not as strong as I would like, but after a bit of research, I think I figured out a decent version, if you just want to match the possessive form of names:

(?-i)(\b)Eleanor('s)?(\b) 

It doesn't work for names already ending in s that just get an apostrophe to become possessive.  If you can easily switch between the two based on whether the name ends in s or not, you can use a very similar one for those:

(?-i)(\b)James'?(\b) 

Writing a regex that matches the name, the name with an 's after it, and the name with just an apostrophe after an ending s is beyond my current skill.  I'm sure it can be done, but I just can't make it work.  However, if you're willing to allow just an apostrophe after any name, I think this works:

(?-i)(\b)Eleanor('s?)?(\b) 


If you're wanting to have a single regex that works for possessive forms and contractions, I think it would be something like this:

(?-i)(\b)Eleanor (?:'(s|m|d|t|ll|re|ve))?(\b) 


I don't know if that's helpful, but I hope so.  Either way, it was a good learning exercise for me.

Simon Haynes

unread,
May 26, 2026, 12:30:04 AMMay 26
to ywr...@googlegroups.com
Thanks for that - I think maybe the reason I included the entire alphabet after the ' was in case other languages use different letters for a possessive.

--
Visit Spacejock Software, the home of yWriter, FCharts and more
Visit spacejock.com.au for my articles on writing and publishing novels.

Andrew Applegarth

unread,
May 26, 2026, 2:20:38 AMMay 26
to yWriter
The problem with the way you wrote it is the apostrophe and the single character are optional independently of each other.  That's why it recognized the e as part of her name.  If you want to keep the full alphanumeric range after the apostrophe, you need to replace the two inner question marks with a single outer one.  It would look something like this:

(?-i)(\b)Eleanor('[A-Za-z0-9])?(\b)

That should treat the apostrophe and any alphanumeric character as a single optional element.  If you want to allow for just an apostrophe, there are a couple of ways to do it.   Again, it's hard to only allow the apostrophe by itself when it immediately follows an s, but fairly simple otherwise.  This should be one of the ways:

(?-i)(\b)Eleanor('[A-Za-z0-9]|\')?(\b)

Simon Haynes

unread,
May 26, 2026, 2:33:27 AMMay 26
to ywr...@googlegroups.com
The other issue is that many writers use the single quotes (including the apostrophe) for dialogue, rather than double quotes, so I also had to allow for that case.

To be honest, it's all just cosmetic. I could remove that regex code altogether and then the character's name would be highlighted but the 's possessive wouldn't. I was just being a bit of a perfectionist.



--
Visit Spacejock Software, the home of yWriter, FCharts and more
Visit spacejock.com.au for my articles on writing and publishing novels.

Reply all
Reply to author
Forward
0 new messages