In this case the regex may be "fixable"
The orig regex matches any text that
- starts and ends in a letter
- is between 7 and 52 chars long
- can have any amount of
single dots
between any 2 letters.
Since the text has only dots and letters, the lookahead (?!\\.) means a letter must follow => and hence this is a word boundary.
I did not test, but I would expect that this should work:
^[a-z](\\.\\b|[a-z]){5,50}[a-z]$
Depending on what "only at the end of an expression" means exactly... (I.e. only at the very end of the entire regex, or any sub-expression?), there may be another options.
The condition is that the overall length should be between 7 and 52 chars....
If we temporary
ignore the length, the regex becomes real simple:
- starts with one or more letters
- followed by zero, one or more: dot with at least one letter after it
(that also ensures the last char is a letter)
If we can place the lookahead at the very start, we can check the length first
^(?=.{7,52}$)[a-z]+(\\.[a-z]+)+$
That does 2 matches, both from the start, and both required to succeed.
- check the length
- check the content as explained